2021-09-08 14:31:47 +00:00
|
|
|
error: called `unwrap` on `x` after checking its variant with `is_some`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:47:9
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_some() {
|
2021-09-08 14:31:47 +00:00
|
|
|
| -------------- help: try: `if let Some(..) = x`
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | // unnecessary
|
|
|
|
LL | x.unwrap();
|
2019-07-15 19:27:44 +00:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
|
2020-01-31 19:21:10 +00:00
|
|
|
note: the lint level is defined here
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:3:35
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2021-09-08 14:31:47 +00:00
|
|
|
error: called `expect` on `x` after checking its variant with `is_some`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:50:9
|
2021-09-08 14:31:47 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_some() {
|
|
|
|
| -------------- help: try: `if let Some(..) = x`
|
2023-07-28 18:40:44 +00:00
|
|
|
...
|
|
|
|
LL | x.expect("an error message");
|
2021-09-08 14:31:47 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2020-08-11 13:43:21 +00:00
|
|
|
error: this call to `unwrap()` will always panic
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:54:9
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_some() {
|
|
|
|
| ----------- because of this check
|
|
|
|
...
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | x.unwrap();
|
2019-07-15 19:27:44 +00:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
|
2020-01-31 19:21:10 +00:00
|
|
|
note: the lint level is defined here
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:3:9
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2021-09-08 14:31:47 +00:00
|
|
|
error: this call to `expect()` will always panic
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:57:9
|
2021-09-08 14:31:47 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_some() {
|
|
|
|
| ----------- because of this check
|
|
|
|
...
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | x.expect("an error message");
|
2021-09-08 14:31:47 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2020-08-11 13:43:21 +00:00
|
|
|
error: this call to `unwrap()` will always panic
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:62:9
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_none() {
|
|
|
|
| ----------- because of this check
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | // will panic
|
|
|
|
LL | x.unwrap();
|
2019-07-15 19:27:44 +00:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
2021-09-08 14:31:47 +00:00
|
|
|
error: called `unwrap` on `x` after checking its variant with `is_none`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:66:9
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_none() {
|
2021-09-08 14:31:47 +00:00
|
|
|
| -------------- help: try: `if let Some(..) = x`
|
2019-07-15 19:27:44 +00:00
|
|
|
...
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | x.unwrap();
|
2019-07-15 19:27:44 +00:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
2021-09-08 14:31:47 +00:00
|
|
|
error: called `unwrap` on `x` after checking its variant with `is_some`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:14:13
|
2020-02-04 20:38:26 +00:00
|
|
|
|
|
|
|
|
LL | if $a.is_some() {
|
2021-09-08 14:31:47 +00:00
|
|
|
| --------------- help: try: `if let Some(..) = x`
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | // unnecessary
|
|
|
|
LL | $a.unwrap();
|
2020-02-04 20:38:26 +00:00
|
|
|
| ^^^^^^^^^^^
|
|
|
|
...
|
|
|
|
LL | m!(x);
|
2021-10-14 18:28:30 +00:00
|
|
|
| ----- in this macro invocation
|
2020-02-07 03:34:06 +00:00
|
|
|
|
|
2021-02-13 19:52:25 +00:00
|
|
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
2020-02-04 20:38:26 +00:00
|
|
|
|
2021-09-08 14:31:47 +00:00
|
|
|
error: called `unwrap` on `x` after checking its variant with `is_ok`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:79:9
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_ok() {
|
2021-09-08 14:31:47 +00:00
|
|
|
| ------------ help: try: `if let Ok(..) = x`
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | // unnecessary
|
|
|
|
LL | x.unwrap();
|
2019-07-15 19:27:44 +00:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
2021-09-08 14:31:47 +00:00
|
|
|
error: called `expect` on `x` after checking its variant with `is_ok`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:82:9
|
2021-09-08 14:31:47 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_ok() {
|
|
|
|
| ------------ help: try: `if let Ok(..) = x`
|
2023-07-28 18:40:44 +00:00
|
|
|
...
|
|
|
|
LL | x.expect("an error message");
|
2021-09-08 14:31:47 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2020-08-11 13:43:21 +00:00
|
|
|
error: this call to `unwrap_err()` will always panic
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:85:9
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_ok() {
|
|
|
|
| --------- because of this check
|
2021-09-08 14:31:47 +00:00
|
|
|
...
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | x.unwrap_err();
|
2019-07-15 19:27:44 +00:00
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
2020-08-11 13:43:21 +00:00
|
|
|
error: this call to `unwrap()` will always panic
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:89:9
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_ok() {
|
|
|
|
| --------- because of this check
|
|
|
|
...
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | x.unwrap();
|
2019-07-15 19:27:44 +00:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
2021-09-08 14:31:47 +00:00
|
|
|
error: this call to `expect()` will always panic
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:92:9
|
2021-09-08 14:31:47 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_ok() {
|
|
|
|
| --------- because of this check
|
|
|
|
...
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | x.expect("an error message");
|
2021-09-08 14:31:47 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: called `unwrap_err` on `x` after checking its variant with `is_ok`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:95:9
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_ok() {
|
2021-09-08 14:31:47 +00:00
|
|
|
| ------------ help: try: `if let Err(..) = x`
|
2019-07-15 19:27:44 +00:00
|
|
|
...
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | x.unwrap_err();
|
2019-07-15 19:27:44 +00:00
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
2020-08-11 13:43:21 +00:00
|
|
|
error: this call to `unwrap()` will always panic
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:100:9
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_err() {
|
|
|
|
| ---------- because of this check
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | // will panic
|
|
|
|
LL | x.unwrap();
|
2019-07-15 19:27:44 +00:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
2021-09-08 14:31:47 +00:00
|
|
|
error: called `unwrap_err` on `x` after checking its variant with `is_err`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:103:9
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_err() {
|
2021-09-08 14:31:47 +00:00
|
|
|
| ------------- help: try: `if let Err(..) = x`
|
2023-07-28 18:40:44 +00:00
|
|
|
...
|
|
|
|
LL | x.unwrap_err();
|
2019-07-15 19:27:44 +00:00
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
2021-09-08 14:31:47 +00:00
|
|
|
error: called `unwrap` on `x` after checking its variant with `is_err`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:107:9
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_err() {
|
2021-09-08 14:31:47 +00:00
|
|
|
| ------------- help: try: `if let Ok(..) = x`
|
2019-07-15 19:27:44 +00:00
|
|
|
...
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | x.unwrap();
|
2019-07-15 19:27:44 +00:00
|
|
|
| ^^^^^^^^^^
|
|
|
|
|
2020-08-11 13:43:21 +00:00
|
|
|
error: this call to `unwrap_err()` will always panic
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:110:9
|
2019-07-15 19:27:44 +00:00
|
|
|
|
|
|
|
|
LL | if x.is_err() {
|
|
|
|
| ---------- because of this check
|
|
|
|
...
|
2023-07-28 18:40:44 +00:00
|
|
|
LL | x.unwrap_err();
|
2019-07-15 19:27:44 +00:00
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
2023-08-23 19:02:01 +00:00
|
|
|
error: called `unwrap` on `option` after checking its variant with `is_some`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:135:9
|
2023-08-23 19:02:01 +00:00
|
|
|
|
|
|
|
|
LL | if option.is_some() {
|
|
|
|
| ------------------- help: try: `if let Some(..) = &option`
|
|
|
|
LL | option.as_ref().unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: this call to `unwrap()` will always panic
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:138:9
|
2023-08-23 19:02:01 +00:00
|
|
|
|
|
|
|
|
LL | if option.is_some() {
|
|
|
|
| ---------------- because of this check
|
|
|
|
...
|
|
|
|
LL | option.as_ref().unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: called `unwrap` on `result` after checking its variant with `is_ok`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:145:9
|
2023-08-23 19:02:01 +00:00
|
|
|
|
|
|
|
|
LL | if result.is_ok() {
|
|
|
|
| ----------------- help: try: `if let Ok(..) = &result`
|
|
|
|
LL | result.as_ref().unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: this call to `unwrap()` will always panic
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:148:9
|
2023-08-23 19:02:01 +00:00
|
|
|
|
|
|
|
|
LL | if result.is_ok() {
|
|
|
|
| -------------- because of this check
|
|
|
|
...
|
|
|
|
LL | result.as_ref().unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: called `unwrap` on `option` after checking its variant with `is_some`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:154:9
|
2023-08-23 19:02:01 +00:00
|
|
|
|
|
|
|
|
LL | if option.is_some() {
|
|
|
|
| ------------------- help: try: `if let Some(..) = &mut option`
|
|
|
|
LL | option.as_mut().unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: this call to `unwrap()` will always panic
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:157:9
|
2023-08-23 19:02:01 +00:00
|
|
|
|
|
|
|
|
LL | if option.is_some() {
|
|
|
|
| ---------------- because of this check
|
|
|
|
...
|
|
|
|
LL | option.as_mut().unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: called `unwrap` on `result` after checking its variant with `is_ok`
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:163:9
|
2023-08-23 19:02:01 +00:00
|
|
|
|
|
|
|
|
LL | if result.is_ok() {
|
|
|
|
| ----------------- help: try: `if let Ok(..) = &mut result`
|
|
|
|
LL | result.as_mut().unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: this call to `unwrap()` will always panic
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/checked_unwrap/simple_conditionals.rs:166:9
|
2023-08-23 19:02:01 +00:00
|
|
|
|
|
|
|
|
LL | if result.is_ok() {
|
|
|
|
| -------------- because of this check
|
|
|
|
...
|
|
|
|
LL | result.as_mut().unwrap();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: aborting due to 25 previous errors
|
2019-07-15 19:27:44 +00:00
|
|
|
|