mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 05:03:21 +00:00
Update stderrs
This commit is contained in:
parent
2dc73c45d5
commit
3999b30d9b
7 changed files with 69 additions and 26 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
error: called `filter(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.filter_map(..)` instead.
|
||||
error: called `filter(p).map(q)` on an `Iterator`
|
||||
--> $DIR/filter_methods.rs:5:21
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5; 6].into_iter().filter(|&x| x == 0).map(|x| x * 2).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::filter-map` implied by `-D warnings`
|
||||
= help: This is more succinctly expressed by calling `.filter_map(..)` instead.
|
||||
|
||||
error: called `filter(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator.
|
||||
error: called `filter(p).flat_map(q)` on an `Iterator`
|
||||
--> $DIR/filter_methods.rs:7:21
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5_i8; 6]
|
||||
|
@ -15,8 +16,10 @@ LL | | .into_iter()
|
|||
LL | | .filter(|&x| x == 0)
|
||||
LL | | .flat_map(|x| x.checked_mul(2))
|
||||
| |_______________________________________^
|
||||
|
|
||||
= help: This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator.
|
||||
|
||||
error: called `filter_map(p).flat_map(q)` on an `Iterator`. This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator.
|
||||
error: called `filter_map(p).flat_map(q)` on an `Iterator`
|
||||
--> $DIR/filter_methods.rs:13:21
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5_i8; 6]
|
||||
|
@ -25,8 +28,10 @@ LL | | .into_iter()
|
|||
LL | | .filter_map(|x| x.checked_mul(2))
|
||||
LL | | .flat_map(|x| x.checked_mul(2))
|
||||
| |_______________________________________^
|
||||
|
|
||||
= help: This is more succinctly expressed by calling `.flat_map(..)` and filtering by returning an empty Iterator.
|
||||
|
||||
error: called `filter_map(p).map(q)` on an `Iterator`. This is more succinctly expressed by only calling `.filter_map(..)` instead.
|
||||
error: called `filter_map(p).map(q)` on an `Iterator`
|
||||
--> $DIR/filter_methods.rs:19:21
|
||||
|
|
||||
LL | let _: Vec<_> = vec![5_i8; 6]
|
||||
|
@ -35,6 +40,8 @@ LL | | .into_iter()
|
|||
LL | | .filter_map(|x| x.checked_mul(2))
|
||||
LL | | .map(|x| x.checked_mul(2))
|
||||
| |__________________________________^
|
||||
|
|
||||
= help: This is more succinctly expressed by only calling `.filter_map(..)` instead.
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
error: called `find(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead.
|
||||
error: called `find(p).map(q)` on an `Iterator`
|
||||
--> $DIR/find_map.rs:20:26
|
||||
|
|
||||
LL | let _: Option<i32> = a.iter().find(|s| s.parse::<i32>().is_ok()).map(|s| s.parse().unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::find-map` implied by `-D warnings`
|
||||
= help: This is more succinctly expressed by calling `.find_map(..)` instead.
|
||||
|
||||
error: called `find(p).map(q)` on an `Iterator`. This is more succinctly expressed by calling `.find_map(..)` instead.
|
||||
error: called `find(p).map(q)` on an `Iterator`
|
||||
--> $DIR/find_map.rs:22:29
|
||||
|
|
||||
LL | let _: Option<Flavor> = desserts_of_the_week
|
||||
|
@ -18,6 +19,8 @@ LL | | Dessert::Cake(_) => true,
|
|||
LL | | _ => unreachable!(),
|
||||
LL | | });
|
||||
| |__________^
|
||||
|
|
||||
= help: This is more succinctly expressed by calling `.find_map(..)` instead.
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,28 +1,35 @@
|
|||
error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
|
||||
error: called `skip(x).next()` on an iterator
|
||||
--> $DIR/iter_skip_next.rs:13:13
|
||||
|
|
||||
LL | let _ = some_vec.iter().skip(42).next();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::iter-skip-next` implied by `-D warnings`
|
||||
= help: This is more succinctly expressed by calling `nth(x)`.
|
||||
|
||||
error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
|
||||
error: called `skip(x).next()` on an iterator
|
||||
--> $DIR/iter_skip_next.rs:14:13
|
||||
|
|
||||
LL | let _ = some_vec.iter().cycle().skip(42).next();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: This is more succinctly expressed by calling `nth(x)`.
|
||||
|
||||
error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
|
||||
error: called `skip(x).next()` on an iterator
|
||||
--> $DIR/iter_skip_next.rs:15:13
|
||||
|
|
||||
LL | let _ = (1..10).skip(10).next();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: This is more succinctly expressed by calling `nth(x)`.
|
||||
|
||||
error: called `skip(x).next()` on an iterator. This is more succinctly expressed by calling `nth(x)`
|
||||
error: called `skip(x).next()` on an iterator
|
||||
--> $DIR/iter_skip_next.rs:16:14
|
||||
|
|
||||
LL | let _ = &some_vec[..].iter().skip(3).next();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: This is more succinctly expressed by calling `nth(x)`.
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
@ -1,34 +1,43 @@
|
|||
error: called `ok().expect()` on a `Result` value. You can call `expect()` directly on the `Result`
|
||||
error: called `ok().expect()` on a `Result` value
|
||||
--> $DIR/ok_expect.rs:14:5
|
||||
|
|
||||
LL | res.ok().expect("disaster!");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::ok-expect` implied by `-D warnings`
|
||||
= help: You can call `expect()` directly on the `Result`
|
||||
|
||||
error: called `ok().expect()` on a `Result` value. You can call `expect()` directly on the `Result`
|
||||
error: called `ok().expect()` on a `Result` value
|
||||
--> $DIR/ok_expect.rs:20:5
|
||||
|
|
||||
LL | res3.ok().expect("whoof");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: You can call `expect()` directly on the `Result`
|
||||
|
||||
error: called `ok().expect()` on a `Result` value. You can call `expect()` directly on the `Result`
|
||||
error: called `ok().expect()` on a `Result` value
|
||||
--> $DIR/ok_expect.rs:22:5
|
||||
|
|
||||
LL | res4.ok().expect("argh");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: You can call `expect()` directly on the `Result`
|
||||
|
||||
error: called `ok().expect()` on a `Result` value. You can call `expect()` directly on the `Result`
|
||||
error: called `ok().expect()` on a `Result` value
|
||||
--> $DIR/ok_expect.rs:24:5
|
||||
|
|
||||
LL | res5.ok().expect("oops");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: You can call `expect()` directly on the `Result`
|
||||
|
||||
error: called `ok().expect()` on a `Result` value. You can call `expect()` directly on the `Result`
|
||||
error: called `ok().expect()` on a `Result` value
|
||||
--> $DIR/ok_expect.rs:26:5
|
||||
|
|
||||
LL | res6.ok().expect("meh");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: You can call `expect()` directly on the `Result`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
error: used `unwrap()` on `an Option` value. If you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message
|
||||
error: used `unwrap()` on `an Option` value
|
||||
--> $DIR/unwrap.rs:5:13
|
||||
|
|
||||
LL | let _ = opt.unwrap();
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::option-unwrap-used` implied by `-D warnings`
|
||||
= help: If you don't want to handle the `None` case gracefully, consider using `expect()` to provide a better panic message.
|
||||
|
||||
error: used `unwrap()` on `a Result` value. If you don't want to handle the `Err` case gracefully, consider using `expect()` to provide a better panic message
|
||||
error: used `unwrap()` on `a Result` value
|
||||
--> $DIR/unwrap.rs:10:13
|
||||
|
|
||||
LL | let _ = res.unwrap();
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::result-unwrap-used` implied by `-D warnings`
|
||||
= help: If you don't want to handle the `Err` case gracefully, consider using `expect()` to provide a better panic message.
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue