mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:15:12 +00:00
Enable nursery rules: 'redundant_clone', 'debug_assert_with_mut_call', and 'unused_peekable' (#13920)
This commit is contained in:
parent
337af836d3
commit
32b57b2ee4
15 changed files with 28 additions and 28 deletions
|
@ -88,7 +88,7 @@ where
|
|||
let line_end = locator.full_line_end(script_start.end());
|
||||
let rest = locator.after(line_end);
|
||||
let mut end_offset = None;
|
||||
let mut lines = UniversalNewlineIterator::with_offset(rest, line_end).peekable();
|
||||
let mut lines = UniversalNewlineIterator::with_offset(rest, line_end);
|
||||
|
||||
while let Some(line) = lines.next() {
|
||||
let Some(content) = script_line_content(&line) else {
|
||||
|
|
|
@ -1850,7 +1850,7 @@ static GOOGLE_ARGS_REGEX: LazyLock<Regex> =
|
|||
LazyLock::new(|| Regex::new(r"^\s*(\*?\*?\w+)\s*(\(.*?\))?\s*:(\r\n|\n)?\s*.+").unwrap());
|
||||
|
||||
fn args_section(context: &SectionContext) -> FxHashSet<String> {
|
||||
let mut following_lines = context.following_lines().peekable();
|
||||
let mut following_lines = context.following_lines();
|
||||
let Some(first_line) = following_lines.next() else {
|
||||
return FxHashSet::default();
|
||||
};
|
||||
|
|
|
@ -122,10 +122,7 @@ impl TestRule for StableTestRuleSafeFix {
|
|||
} else {
|
||||
Some(
|
||||
Diagnostic::new(StableTestRuleSafeFix, ruff_text_size::TextRange::default())
|
||||
.with_fix(Fix::safe_edit(Edit::insertion(
|
||||
comment.to_string(),
|
||||
TextSize::new(0),
|
||||
))),
|
||||
.with_fix(Fix::safe_edit(Edit::insertion(comment, TextSize::new(0)))),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -169,10 +166,7 @@ impl TestRule for StableTestRuleUnsafeFix {
|
|||
StableTestRuleUnsafeFix,
|
||||
ruff_text_size::TextRange::default(),
|
||||
)
|
||||
.with_fix(Fix::unsafe_edit(Edit::insertion(
|
||||
comment.to_string(),
|
||||
TextSize::new(0),
|
||||
))),
|
||||
.with_fix(Fix::unsafe_edit(Edit::insertion(comment, TextSize::new(0)))),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +211,7 @@ impl TestRule for StableTestRuleDisplayOnlyFix {
|
|||
ruff_text_size::TextRange::default(),
|
||||
)
|
||||
.with_fix(Fix::display_only_edit(Edit::insertion(
|
||||
comment.to_string(),
|
||||
comment,
|
||||
TextSize::new(0),
|
||||
))),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue