Skip to content

Commit

Permalink
Run clippy and fixes after merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
konysko committed Feb 5, 2023
1 parent 23a9343 commit 3b6438f
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ruff_cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ impl ConfigProcessor for &Overrides {
.ignore
.iter()
.cloned()
.chain(self.extend_ignore.iter().cloned().into_iter())
.chain(self.extend_ignore.iter().cloned())
.flatten()
.collect(),
extend_select: self.extend_select.clone().unwrap_or_default(),
Expand Down
2 changes: 1 addition & 1 deletion src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ mod tests {
for rule in Rule::iter() {
let code = rule.code();
let (linter, rest) =
Linter::parse_code(code).unwrap_or_else(|| panic!("couldn't parse {:?}", code));
Linter::parse_code(code).unwrap_or_else(|| panic!("couldn't parse {code:?}"));
assert_eq!(code, format!("{}{rest}", linter.common_prefix()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,7 @@ pub fn unused_loop_control_variable(
let scope = checker.current_scope();
if let Some(binding) = iter::once(scope.bindings.get(name))
.flatten()
.chain(
iter::once(scope.rebounds.get(name))
.flatten()
.into_iter()
.flatten(),
)
.chain(iter::once(scope.rebounds.get(name)).flatten().flatten())
.find_map(|index| {
let binding = &checker.bindings[*index];
if let Some(source) = &binding.source {
Expand Down
2 changes: 1 addition & 1 deletion src/rules/flake8_django/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ mod tests {
use anyhow::Result;
use test_case::test_case;

use crate::linter::test_path;
use crate::registry::Rule;
use crate::test::test_path;
use crate::{assert_yaml_snapshot, settings};

#[test_case(Rule::ModelDunderStr, Path::new("DJ08.py"); "DJ08")]
Expand Down
6 changes: 3 additions & 3 deletions src/rules/flake8_django/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl Violation for ModelStringFieldNullable {
format!("Avoid using null=True on string-based fields such as {field}.")
}
}
const NOT_NULL_TRUE_FIELDS: [&'static str; 6] = [
const NOT_NULL_TRUE_FIELDS: [&str; 6] = [
"CharField",
"TextField",
"SlugField",
Expand All @@ -137,7 +137,7 @@ const NOT_NULL_TRUE_FIELDS: [&'static str; 6] = [
impl ModelStringFieldNullable {
pub fn check(bases: &[Expr], body: &[Stmt]) -> Vec<Diagnostic> {
let mut errors = Vec::new();
if !bases.iter().any(|val| is_model(val)) {
if !bases.iter().any(is_model) {
return errors;
}
for statement in body.iter() {
Expand All @@ -154,7 +154,7 @@ impl ModelStringFieldNullable {
errors
}

fn check_nullable_field(value: &Box<Expr>) -> Option<&str> {
fn check_nullable_field(value: &Expr) -> Option<&str> {
let Call {func, keywords, ..} = &value.node else {
return None;
};
Expand Down
2 changes: 1 addition & 1 deletion src/rules/flake8_self/rules/private_member_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn private_member_access(checker: &mut Checker, expr: &Expr) {
if !VALID_IDS.contains(&id.as_str()) {
checker.diagnostics.push(Diagnostic::new(
PrivateMemberAccess {
access: format!("{}.{}", id, attr),
access: format!("{id}.{attr}"),
},
Range::from_located(expr),
));
Expand Down

0 comments on commit 3b6438f

Please sign in to comment.