Tidy clippy allows
This commit is contained in:
parent
99dfcb6756
commit
2f1113ead8
@ -151,7 +151,9 @@ pub enum Color {
|
||||
WhiteSmoke, // = 0xF5F5F5,
|
||||
Yellow, // = 0xFFFF00,
|
||||
YellowGreen, // = 0x9ACD32,
|
||||
#[allow(dead_code)]
|
||||
RGB(u8, u8, u8),
|
||||
#[allow(dead_code)]
|
||||
RGBA(u8, u8, u8, u8),
|
||||
}
|
||||
|
||||
|
23
src/main.rs
23
src/main.rs
@ -7,21 +7,36 @@
|
||||
)]
|
||||
#![deny(missing_debug_implementations)]
|
||||
#![allow(
|
||||
dead_code,
|
||||
clippy::pub_enum_variant_names,
|
||||
// explicit return makes some things look ugly
|
||||
clippy::implicit_return,
|
||||
// Self { .. } is less explicit than Foo { .. }
|
||||
clippy::use_self,
|
||||
// this is way too pedantic -- some things don't need docs!
|
||||
clippy::missing_docs_in_private_items,
|
||||
// this crate is too new to deny todo!()
|
||||
clippy::todo,
|
||||
// unreachable!() has many valid use cases
|
||||
clippy::unreachable,
|
||||
// _ => {} has many valid use cases
|
||||
clippy::wildcard_enum_match_arm,
|
||||
// .expect() has many valid use cases, like when we know a value is `Some(..)`
|
||||
clippy::option_expect_used,
|
||||
// for now, panic() is an acceptable solution
|
||||
clippy::panic,
|
||||
clippy::unused_self,
|
||||
// for now, some functions require a lot of lines
|
||||
// future refactoring should make functions small and make
|
||||
// this lint less annoying
|
||||
clippy::too_many_lines,
|
||||
// this is too pedantic -- we are allowed to add numbers!
|
||||
clippy::integer_arithmetic,
|
||||
// this is too pedantic for now -- the library is changing too quickly for
|
||||
// good docs to be written
|
||||
clippy::missing_errors_doc,
|
||||
// this incorrectly results in errors for types that derive `Debug`
|
||||
// https://github.com/rust-lang/rust-clippy/issues/4980
|
||||
clippy::let_underscore_must_use,
|
||||
// this is too pedantic -- it results in some names being less explicit
|
||||
// than they should
|
||||
clippy::module_name_repetitions
|
||||
)]
|
||||
#![feature(track_caller)]
|
||||
@ -229,6 +244,7 @@ impl StyleSheet {
|
||||
PrettyPrinter::new(buf).pretty_print(self)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn pretty_print_selectors<W: Write>(&self, buf: W) -> io::Result<()> {
|
||||
PrettyPrinter::new(buf).pretty_print_preserve_super_selectors(self)
|
||||
}
|
||||
@ -571,7 +587,6 @@ pub(crate) fn eat_expr<I: Iterator<Item = Token>>(
|
||||
devour_whitespace(toks);
|
||||
return Ok(Some(Expr::Selector(Selector::from_tokens(
|
||||
&mut values.iter().peekable(),
|
||||
super_selector,
|
||||
scope,
|
||||
))));
|
||||
}
|
||||
|
@ -57,8 +57,8 @@ impl Mixin {
|
||||
while let Some(expr) = eat_expr(&mut self.body, scope, super_selector)? {
|
||||
match expr {
|
||||
Expr::Style(s) => stmts.push(Stmt::Style(s)),
|
||||
Expr::Include(_) => todo!(),
|
||||
Expr::MixinDecl(_, _) => todo!(),
|
||||
Expr::Include(_)
|
||||
| Expr::MixinDecl(_, _) => todo!(),
|
||||
Expr::Selector(s) => {
|
||||
self.nesting += 1;
|
||||
let rules = self.eval(&super_selector.clone().zip(s.clone()), scope)?;
|
||||
|
@ -163,15 +163,13 @@ mod test_selector_display {
|
||||
}
|
||||
|
||||
struct SelectorParser<'a> {
|
||||
super_selector: &'a Selector,
|
||||
scope: &'a Scope,
|
||||
selectors: Vec<SelectorKind>,
|
||||
}
|
||||
|
||||
impl<'a> SelectorParser<'a> {
|
||||
const fn new(super_selector: &'a Selector, scope: &'a Scope) -> SelectorParser<'a> {
|
||||
const fn new(scope: &'a Scope) -> SelectorParser<'a> {
|
||||
SelectorParser {
|
||||
super_selector,
|
||||
scope,
|
||||
selectors: Vec::new(),
|
||||
}
|
||||
@ -270,10 +268,9 @@ impl<'a> SelectorParser<'a> {
|
||||
impl Selector {
|
||||
pub fn from_tokens<'a>(
|
||||
tokens: &'a mut Peekable<Iter<'a, Token>>,
|
||||
super_selector: &'a Selector,
|
||||
scope: &'a Scope,
|
||||
) -> Selector {
|
||||
SelectorParser::new(super_selector, scope).all_selectors(tokens)
|
||||
SelectorParser::new(scope).all_selectors(tokens)
|
||||
}
|
||||
|
||||
pub fn zip(self, other: Selector) -> Selector {
|
||||
|
Loading…
x
Reference in New Issue
Block a user