mirror of https://github.com/astral-sh/ruff
Fix clippy warnings
This commit is contained in:
parent
14cf36f922
commit
f38bba18ee
|
|
@ -7,6 +7,7 @@ use std::path::Path;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
#[cfg(not(target_family = "wasm"))]
|
#[cfg(not(target_family = "wasm"))]
|
||||||
use log::debug;
|
use log::debug;
|
||||||
|
use nohash_hasher::IntMap;
|
||||||
use rustpython_parser::lexer::LexResult;
|
use rustpython_parser::lexer::LexResult;
|
||||||
|
|
||||||
use crate::ast::types::Range;
|
use crate::ast::types::Range;
|
||||||
|
|
@ -46,6 +47,7 @@ impl AddAssign for Diagnostics {
|
||||||
|
|
||||||
/// Generate a list of `Check` violations from the source code contents at the
|
/// Generate a list of `Check` violations from the source code contents at the
|
||||||
/// given `Path`.
|
/// given `Path`.
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub(crate) fn check_path(
|
pub(crate) fn check_path(
|
||||||
path: &Path,
|
path: &Path,
|
||||||
contents: &str,
|
contents: &str,
|
||||||
|
|
@ -252,7 +254,7 @@ pub fn add_noqa_to_path(path: &Path, settings: &Settings) -> Result<usize> {
|
||||||
tokens,
|
tokens,
|
||||||
&locator,
|
&locator,
|
||||||
&Directives {
|
&Directives {
|
||||||
noqa_line_for: Default::default(),
|
noqa_line_for: IntMap::default(),
|
||||||
isort_exclusions: directives.isort_exclusions,
|
isort_exclusions: directives.isort_exclusions,
|
||||||
},
|
},
|
||||||
settings,
|
settings,
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ fn add_noqa_inner(
|
||||||
let mut new_line = String::new();
|
let mut new_line = String::new();
|
||||||
|
|
||||||
// Add existing content.
|
// Add existing content.
|
||||||
new_line.push_str(&line[..start].trim_end());
|
new_line.push_str(line[..start].trim_end());
|
||||||
|
|
||||||
// Add `noqa` directive.
|
// Add `noqa` directive.
|
||||||
new_line.push_str(" # noqa: ");
|
new_line.push_str(" # noqa: ");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue