Skip to content

Commit

Permalink
Disallow some restriction lints (#3754)
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Mar 26, 2023
1 parent 2326335 commit 31fff4b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,11 @@ rustflags = [
"-Wclippy::print_stdout",
"-Wclippy::print_stderr",
"-Wclippy::dbg_macro",
"-Wclippy::empty_drop",
"-Wclippy::empty_structs_with_brackets",
"-Wclippy::exit",
"-Wclippy::get_unwrap",
"-Wclippy::rc_buffer",
"-Wclippy::rc_mutex",
"-Wclippy::rest_pat_in_fully_bound_structs",
]
3 changes: 1 addition & 2 deletions crates/ruff/src/checkers/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ mod deferred;

type AnnotationContext = (bool, bool);

#[allow(clippy::struct_excessive_bools)]
pub struct Checker<'a> {
// Settings, static metadata, etc.
pub path: &'a Path,
Expand Down Expand Up @@ -3582,7 +3581,7 @@ where
} else {
// Ex) DefaultNamedArg(type="bool", name="some_prop_name")
for keyword in keywords {
let KeywordData { value, arg, .. } = &keyword.node;
let KeywordData { value, arg } = &keyword.node;
if arg.as_ref().map_or(false, |arg| arg == "type") {
visit_type_definition!(self, value);
} else {
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff/src/rules/flake8_simplify/rules/ast_bool_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl AlwaysAutofixableViolation for CompareWithTuple {
}

fn autofix_title(&self) -> String {
let CompareWithTuple { replacement, .. } = self;
let CompareWithTuple { replacement } = self;
format!("Replace with `{replacement}`")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Violation for YodaConditions {
}

fn autofix_title_formatter(&self) -> Option<fn(&Self) -> String> {
let YodaConditions { suggestion, .. } = self;
let YodaConditions { suggestion } = self;
if suggestion.is_some() {
Some(|YodaConditions { suggestion }| {
let suggestion = suggestion.as_ref().unwrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ fn is_valid_constant(formats: &[CFormatStrOrBytes<String>], value: &Expr) -> boo
if formats.len() != 1 {
return true;
}
let format = formats.get(0).unwrap();
let format = formats[0];
equivalent(format, value)
}

Expand Down
2 changes: 0 additions & 2 deletions crates/ruff_macros/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ fn handle_option_group(field: &Field) -> syn::Result<proc_macro2::TokenStream> {
ident: type_ident,
arguments:
PathArguments::AngleBracketed(AngleBracketedGenericArguments { args, .. }),
..
}) if type_ident == "Option" => {
let path = &args[0];
let kebab_name = LitStr::new(&ident.to_string().replace('_', "-"), ident.span());
Expand Down Expand Up @@ -142,7 +141,6 @@ fn handle_option(
default,
value_type,
example,
..
} = attr.parse_args::<FieldAttributes>()?;
let kebab_name = LitStr::new(&ident.to_string().replace('_', "-"), ident.span());

Expand Down

0 comments on commit 31fff4b

Please sign in to comment.