mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 05:45:24 +00:00
Disallow some restriction lints (#3754)
This commit is contained in:
parent
2326335f5c
commit
31fff4b10e
6 changed files with 11 additions and 7 deletions
|
@ -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",
|
||||
]
|
||||
|
|
|
@ -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,
|
||||
|
@ -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 {
|
||||
|
|
|
@ -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}`")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
@ -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());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue