Skip to content

Commit 3da25ed

Browse files
committed
Rename lint
1 parent 5753614 commit 3da25ed

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1969,7 +1969,8 @@ Released 2018-09-13
19691969
[`fn_to_numeric_cast_with_truncation`]: https://rust-lang.github.io/rust-clippy/master/index.html#fn_to_numeric_cast_with_truncation
19701970
[`for_kv_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_kv_map
19711971
[`for_loops_over_fallibles`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loops_over_fallibles
1972-
[`for_loops_over_options`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loops_over_options
1972+
[`for_loops_over_options_or_results`]:
1973+
https://rust-lang.github.io/rust-clippy/master/index.html#for_loops_over_options_or_results
19731974
[`forget_copy`]: https://rust-lang.github.io/rust-clippy/master/index.html#forget_copy
19741975
[`forget_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#forget_ref
19751976
[`from_iter_instead_of_collect`]: https://rust-lang.github.io/rust-clippy/master/index.html#from_iter_instead_of_collect

clippy_lints/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
685685
&loops::EXPLICIT_ITER_LOOP,
686686
&loops::FOR_KV_MAP,
687687
&loops::FOR_LOOPS_OVER_FALLIBLES,
688-
&loops::FOR_LOOPS_OVER_OPTIONS,
688+
&loops::FOR_LOOPS_OVER_OPTIONS_OR_RESULTS,
689689
&loops::ITER_NEXT_LOOP,
690690
&loops::MANUAL_MEMCPY,
691691
&loops::MUT_RANGE_BOUND,
@@ -1489,7 +1489,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14891489
LintId::of(&loops::EXPLICIT_COUNTER_LOOP),
14901490
LintId::of(&loops::FOR_KV_MAP),
14911491
LintId::of(&loops::FOR_LOOPS_OVER_FALLIBLES),
1492-
LintId::of(&loops::FOR_LOOPS_OVER_OPTIONS),
1492+
LintId::of(&loops::FOR_LOOPS_OVER_OPTIONS_OR_RESULTS),
14931493
LintId::of(&loops::ITER_NEXT_LOOP),
14941494
LintId::of(&loops::MANUAL_MEMCPY),
14951495
LintId::of(&loops::MUT_RANGE_BOUND),
@@ -1822,7 +1822,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
18221822
LintId::of(&lifetimes::EXTRA_UNUSED_LIFETIMES),
18231823
LintId::of(&lifetimes::NEEDLESS_LIFETIMES),
18241824
LintId::of(&loops::EXPLICIT_COUNTER_LOOP),
1825-
LintId::of(&loops::FOR_LOOPS_OVER_OPTIONS),
1825+
LintId::of(&loops::FOR_LOOPS_OVER_OPTIONS_OR_RESULTS),
18261826
LintId::of(&loops::MUT_RANGE_BOUND),
18271827
LintId::of(&loops::SINGLE_ELEMENT_LOOP),
18281828
LintId::of(&loops::WHILE_LET_LOOP),

clippy_lints/src/loops.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ declare_clippy_lint! {
520520
/// println!("{}", n);
521521
/// }
522522
/// ```
523-
pub FOR_LOOPS_OVER_OPTIONS,
523+
pub FOR_LOOPS_OVER_OPTIONS_OR_RESULTS,
524524
complexity,
525525
"for loops over `Option`s or `Result`s with a single expression can be simplified"
526526
}
@@ -532,7 +532,7 @@ declare_lint_pass!(Loops => [
532532
EXPLICIT_INTO_ITER_LOOP,
533533
ITER_NEXT_LOOP,
534534
FOR_LOOPS_OVER_FALLIBLES,
535-
FOR_LOOPS_OVER_OPTIONS,
535+
FOR_LOOPS_OVER_OPTIONS_OR_RESULTS,
536536
WHILE_LET_LOOP,
537537
NEEDLESS_COLLECT,
538538
EXPLICIT_COUNTER_LOOP,
@@ -2012,7 +2012,7 @@ fn check_for_loop_over_options_or_results<'tcx>(
20122012
let arg_snippet = snippet(cx, arg.span, "..");
20132013
let msg = "looping over `Option`s or `Result`s with an `if let` expression.";
20142014
let hint = format!("try turn {} into an `Iterator` and use `flatten`: `{}.iter().flatten()`", arg_snippet, arg_snippet);
2015-
span_lint_and_help(cx, FOR_LOOPS_OVER_OPTIONS, expr.span, msg, None, &hint);
2015+
span_lint_and_help(cx, FOR_LOOPS_OVER_OPTIONS_OR_RESULTS, expr.span, msg, None, &hint);
20162016
}
20172017
}
20182018
}

tests/ui/for_loops_over_options.rs renamed to tests/ui/for_loops_over_options_or_results.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![warn(clippy::for_loops_over_options)]
1+
#![warn(clippy::for_loops_over_options_or_results)]
22

33
fn main() {
44
let x = vec![Some(1), Some(2), Some(3)];

0 commit comments

Comments
 (0)