diff --git a/src/check_ast.rs b/src/check_ast.rs index d2210772bf..60cbc9f9bc 100644 --- a/src/check_ast.rs +++ b/src/check_ast.rs @@ -1,7 +1,6 @@ //! Lint rules based on AST traversal. use std::collections::BTreeMap; -use std::ops::Deref; use std::path::Path; use itertools::Itertools; @@ -745,7 +744,7 @@ where } if self.settings.enabled.contains(&CheckCode::F407) { - if !ALL_FEATURE_NAMES.contains(&alias.node.name.deref()) { + if !ALL_FEATURE_NAMES.contains(&&*alias.node.name) { self.add_check(Check::new( CheckKind::FutureFeatureNotDefined(alias.node.name.to_string()), Range::from_located(stmt), @@ -941,7 +940,7 @@ where self, stmt, test, - msg.as_ref().map(|expr| expr.deref()), + msg.as_ref().map(|expr| &**expr), ); } if self.settings.enabled.contains(&CheckCode::S101) { diff --git a/src/flake8_annotations/plugins.rs b/src/flake8_annotations/plugins.rs index 4fae81850e..e51bbde074 100644 --- a/src/flake8_annotations/plugins.rs +++ b/src/flake8_annotations/plugins.rs @@ -1,5 +1,3 @@ -use std::ops::Deref; - use rustpython_ast::{Arguments, Constant, Expr, ExprKind, Stmt, StmtKind}; use crate::ast::types::Range; @@ -25,9 +23,7 @@ where StmtKind::FunctionDef { .. } | StmtKind::AsyncFunctionDef { .. } => { // No recurse. } - StmtKind::Return { value } => { - self.returns.push(value.as_ref().map(|expr| expr.deref())) - } + StmtKind::Return { value } => self.returns.push(value.as_ref().map(|expr| &**expr)), _ => visitor::walk_stmt(self, stmt), } } diff --git a/src/fs.rs b/src/fs.rs index e487c86056..37f0239a94 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -1,7 +1,6 @@ use std::borrow::Cow; use std::fs::File; use std::io::{BufReader, Read}; -use std::ops::Deref; use std::path::{Path, PathBuf}; use anyhow::{anyhow, Result}; @@ -155,7 +154,7 @@ pub(crate) fn normalize_path_to(path: &Path, project_root: &Path) -> PathBuf { /// Convert an absolute path to be relative to the current working directory. pub(crate) fn relativize_path(path: &Path) -> Cow { - if let Ok(path) = path.strip_prefix(path_dedot::CWD.deref()) { + if let Ok(path) = path.strip_prefix(&*path_dedot::CWD) { return path.to_string_lossy(); } path.to_string_lossy()