From 783e43b7651bcb4e6a0ca67f36da310ac592a360 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sat, 8 Feb 2020 17:03:43 -0500 Subject: [PATCH] clippy --- src/builtin/meta.rs | 2 +- src/lib.rs | 2 ++ src/utils.rs | 2 +- src/value/mod.rs | 2 +- src/value/parse.rs | 14 +++++++------- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/builtin/meta.rs b/src/builtin/meta.rs index d7502c5..afc8d31 100644 --- a/src/builtin/meta.rs +++ b/src/builtin/meta.rs @@ -58,7 +58,7 @@ pub(crate) fn register(f: &mut BTreeMap) { } }); decl!(f "inspect", |args| { - let value = arg!(args, 0, "v­alue"); + let value = arg!(args, 0, "value"); Some(Value::Ident(value.to_string(), QuoteKind::None)) }); } diff --git a/src/lib.rs b/src/lib.rs index 0afb454..5bde040 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,6 +39,8 @@ // than they should clippy::module_name_repetitions, clippy::option_unwrap_used, + // this is too pedantic -- it is sometimes useful to break up `impl`s + clippy::multiple_inherent_impl, )] #![cfg_attr(feature = "nightly", feature(track_caller))] // todo! handle erroring on styles at the toplevel diff --git a/src/utils.rs b/src/utils.rs index 78422d2..9d68986 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -74,7 +74,7 @@ pub(crate) struct VariableDecl { } impl VariableDecl { - pub fn new(val: Value, default: bool) -> VariableDecl { + pub const fn new(val: Value, default: bool) -> VariableDecl { VariableDecl { val, default } } } diff --git a/src/value/mod.rs b/src/value/mod.rs index e7f4dad..e4336d3 100644 --- a/src/value/mod.rs +++ b/src/value/mod.rs @@ -36,7 +36,7 @@ impl Display for Value { f, "{}", vals.iter() - .map(|x| x.to_string()) + .map(std::string::ToString::to_string) .collect::>() .join(sep.as_str()) ), diff --git a/src/value/parse.rs b/src/value/parse.rs index a0c3f1f..e447214 100644 --- a/src/value/parse.rs +++ b/src/value/parse.rs @@ -29,17 +29,17 @@ fn parse_hex(s: String) -> Value { } 6 => { let v = u32::from_str_radix(&s, 16).unwrap(); - let red: u16 = ((v & 0xff0000) >> 16) as u16; - let green: u16 = ((v & 0x00ff00) >> 8) as u16; - let blue: u16 = (v & 0x0000ff) as u16; + let red: u16 = ((v & 0x00ff_0000) >> 16) as u16; + let green: u16 = ((v & 0x0000_ff00) >> 8) as u16; + let blue: u16 = (v & 0x0000_00ff) as u16; Value::Color(Color::new(red, green, blue, 1, format!("#{}", s))) } 8 => { let v = u32::from_str_radix(&s, 16).unwrap(); - let red = ((v & 0xff000000) >> 24) as u16; - let green = ((v & 0x00ff0000) >> 16) as u16; - let blue = ((v & 0x0000ff00) >> 8) as u16; - let alpha = (v & 0x000000ff) as u16; + let red = ((v & 0xff00_0000) >> 24) as u16; + let green = ((v & 0x00ff_0000) >> 16) as u16; + let blue = ((v & 0x0000_ff00) >> 8) as u16; + let alpha = (v & 0x0000_00ff) as u16; Value::Color(Color::new(red, green, blue, alpha, format!("#{}", s))) } _ => Value::Ident(s, QuoteKind::None),