clippy
This commit is contained in:
parent
705ae0c810
commit
783e43b765
@ -58,7 +58,7 @@ pub(crate) fn register(f: &mut BTreeMap<String, Builtin>) {
|
||||
}
|
||||
});
|
||||
decl!(f "inspect", |args| {
|
||||
let value = arg!(args, 0, "value");
|
||||
let value = arg!(args, 0, "value");
|
||||
Some(Value::Ident(value.to_string(), QuoteKind::None))
|
||||
});
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 }
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ impl Display for Value {
|
||||
f,
|
||||
"{}",
|
||||
vals.iter()
|
||||
.map(|x| x.to_string())
|
||||
.map(std::string::ToString::to_string)
|
||||
.collect::<Vec<String>>()
|
||||
.join(sep.as_str())
|
||||
),
|
||||
|
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user