Fix clippy::needless_pass_by_value (pedantic)
“this argument is passed by value, but not consumed in the function body” https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
committed by
Charlie Marsh
parent
348ff509c0
commit
517ca2604a
@@ -20,7 +20,7 @@ fn check_import_blocks(
|
||||
let mut checks = vec![];
|
||||
for block in tracker.into_iter() {
|
||||
if !block.is_empty() {
|
||||
if let Some(check) = isort::plugins::check_imports(block, locator, settings, autofix) {
|
||||
if let Some(check) = isort::plugins::check_imports(&block, locator, settings, autofix) {
|
||||
checks.push(check);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ pub struct Settings {
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
pub fn from_options(options: Options) -> Self {
|
||||
Self {
|
||||
mypy_init_return: options.mypy_init_return.unwrap_or_default(),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum ShadowingType {
|
||||
Variable,
|
||||
Argument,
|
||||
|
||||
@@ -30,13 +30,13 @@ fn extract_indentation(body: &[&Stmt], locator: &SourceCodeLocator) -> String {
|
||||
|
||||
/// I001
|
||||
pub fn check_imports(
|
||||
body: Vec<&Stmt>,
|
||||
body: &[&Stmt],
|
||||
locator: &SourceCodeLocator,
|
||||
settings: &Settings,
|
||||
autofix: &fixer::Mode,
|
||||
) -> Option<Check> {
|
||||
let range = extract_range(&body);
|
||||
let indentation = extract_indentation(&body, locator);
|
||||
let range = extract_range(body);
|
||||
let indentation = extract_indentation(body, locator);
|
||||
|
||||
// Extract comments. Take care to grab any inline comments from the last line.
|
||||
let comments = comments::collect_comments(
|
||||
@@ -53,7 +53,7 @@ pub fn check_imports(
|
||||
|
||||
// Generate the sorted import block.
|
||||
let expected = format_imports(
|
||||
&body,
|
||||
body,
|
||||
comments,
|
||||
settings.line_length - indentation.len(),
|
||||
&settings.src,
|
||||
|
||||
@@ -14,6 +14,7 @@ pub struct Settings {
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
pub fn from_options(options: Options) -> Self {
|
||||
Self {
|
||||
max_complexity: options.max_complexity.unwrap_or_default(),
|
||||
|
||||
@@ -1596,6 +1596,7 @@ static CONFUSABLES: Lazy<FxHashMap<u32, u32>> = Lazy::new(|| {
|
||||
])
|
||||
});
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum Context {
|
||||
String,
|
||||
Docstring,
|
||||
|
||||
Reference in New Issue
Block a user