forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#5084 - JohnTitor:clean-up-span-lint, r=flip1995
Clean up `span_lint` in `methods/mod.rs` Uses `span_help_and_lint` instead of `span_lint` and `span_lint_and_sugg` instead of `span_lint_and_then`. changelog: none
- Loading branch information
Showing
8 changed files
with
121 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
error: used `expect()` on `an Option` value. If this value is an `None` it will panic | ||
error: used `expect()` on `an Option` value | ||
--> $DIR/expect.rs:5:13 | ||
| | ||
LL | let _ = opt.expect(""); | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: `-D clippy::option-expect-used` implied by `-D warnings` | ||
= help: if this value is an `None`, it will panic | ||
|
||
error: used `expect()` on `a Result` value. If this value is an `Err` it will panic | ||
error: used `expect()` on `a Result` value | ||
--> $DIR/expect.rs:10:13 | ||
| | ||
LL | let _ = res.expect(""); | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: `-D clippy::result-expect-used` implied by `-D warnings` | ||
= help: if this value is an `Err`, it will panic | ||
|
||
error: aborting due to 2 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,59 @@ | ||
error: called `.iter().nth()` on a Vec. Calling `.get()` is both faster and more readable | ||
error: called `.iter().nth()` on a Vec | ||
--> $DIR/iter_nth.rs:33:23 | ||
| | ||
LL | let bad_vec = some_vec.iter().nth(3); | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `-D clippy::iter-nth` implied by `-D warnings` | ||
= help: calling `.get()` is both faster and more readable | ||
|
||
error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable | ||
error: called `.iter().nth()` on a slice | ||
--> $DIR/iter_nth.rs:34:26 | ||
| | ||
LL | let bad_slice = &some_vec[..].iter().nth(3); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: calling `.get()` is both faster and more readable | ||
|
||
error: called `.iter().nth()` on a slice. Calling `.get()` is both faster and more readable | ||
error: called `.iter().nth()` on a slice | ||
--> $DIR/iter_nth.rs:35:31 | ||
| | ||
LL | let bad_boxed_slice = boxed_slice.iter().nth(3); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: calling `.get()` is both faster and more readable | ||
|
||
error: called `.iter().nth()` on a VecDeque. Calling `.get()` is both faster and more readable | ||
error: called `.iter().nth()` on a VecDeque | ||
--> $DIR/iter_nth.rs:36:29 | ||
| | ||
LL | let bad_vec_deque = some_vec_deque.iter().nth(3); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: calling `.get()` is both faster and more readable | ||
|
||
error: called `.iter_mut().nth()` on a Vec. Calling `.get_mut()` is both faster and more readable | ||
error: called `.iter_mut().nth()` on a Vec | ||
--> $DIR/iter_nth.rs:41:23 | ||
| | ||
LL | let bad_vec = some_vec.iter_mut().nth(3); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: calling `.get_mut()` is both faster and more readable | ||
|
||
error: called `.iter_mut().nth()` on a slice. Calling `.get_mut()` is both faster and more readable | ||
error: called `.iter_mut().nth()` on a slice | ||
--> $DIR/iter_nth.rs:44:26 | ||
| | ||
LL | let bad_slice = &some_vec[..].iter_mut().nth(3); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: calling `.get_mut()` is both faster and more readable | ||
|
||
error: called `.iter_mut().nth()` on a VecDeque. Calling `.get_mut()` is both faster and more readable | ||
error: called `.iter_mut().nth()` on a VecDeque | ||
--> $DIR/iter_nth.rs:47:29 | ||
| | ||
LL | let bad_vec_deque = some_vec_deque.iter_mut().nth(3); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: calling `.get_mut()` is both faster and more readable | ||
|
||
error: aborting due to 7 previous errors | ||
|
Oops, something went wrong.