rust-clippy/tests/ui/checked_unwrap/simple_conditionals.stderr

241 lines
7.5 KiB
Text
Raw Normal View History

error: called `unwrap` on `x` after checking its variant with `is_some`
--> tests/ui/checked_unwrap/simple_conditionals.rs:46:9
|
LL | if x.is_some() {
2024-08-11 15:33:28 +00:00
| -------------- help: try: `if let Some(<item>) = x`
LL | // unnecessary
LL | x.unwrap();
| ^^^^^^^^^^
|
2020-01-31 19:21:10 +00:00
note: the lint level is defined here
--> tests/ui/checked_unwrap/simple_conditionals.rs:2:35
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: called `expect` on `x` after checking its variant with `is_some`
--> tests/ui/checked_unwrap/simple_conditionals.rs:49:9
|
LL | if x.is_some() {
2024-08-11 15:33:28 +00:00
| -------------- help: try: `if let Some(<item>) = x`
...
LL | x.expect("an error message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:53:9
|
LL | if x.is_some() {
| ----------- because of this check
...
LL | x.unwrap();
| ^^^^^^^^^^
|
2020-01-31 19:21:10 +00:00
note: the lint level is defined here
--> tests/ui/checked_unwrap/simple_conditionals.rs:2:9
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `expect()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:56:9
|
LL | if x.is_some() {
| ----------- because of this check
...
LL | x.expect("an error message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:61:9
|
LL | if x.is_none() {
| ----------- because of this check
LL | // will panic
LL | x.unwrap();
| ^^^^^^^^^^
error: called `unwrap` on `x` after checking its variant with `is_none`
--> tests/ui/checked_unwrap/simple_conditionals.rs:65:9
|
LL | if x.is_none() {
2024-08-11 15:33:28 +00:00
| -------------- help: try: `if let Some(<item>) = x`
...
LL | x.unwrap();
| ^^^^^^^^^^
error: called `unwrap` on `x` after checking its variant with `is_some`
--> tests/ui/checked_unwrap/simple_conditionals.rs:13:13
|
LL | if $a.is_some() {
2024-08-11 15:33:28 +00:00
| --------------- help: try: `if let Some(<item>) = x`
LL | // unnecessary
LL | $a.unwrap();
| ^^^^^^^^^^^
...
LL | m!(x);
| ----- in this macro invocation
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: called `unwrap` on `x` after checking its variant with `is_ok`
--> tests/ui/checked_unwrap/simple_conditionals.rs:78:9
|
LL | if x.is_ok() {
2024-08-11 15:33:28 +00:00
| ------------ help: try: `if let Ok(<item>) = x`
LL | // unnecessary
LL | x.unwrap();
| ^^^^^^^^^^
error: called `expect` on `x` after checking its variant with `is_ok`
--> tests/ui/checked_unwrap/simple_conditionals.rs:81:9
|
LL | if x.is_ok() {
2024-08-11 15:33:28 +00:00
| ------------ help: try: `if let Ok(<item>) = x`
...
LL | x.expect("an error message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap_err()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:84:9
|
LL | if x.is_ok() {
| --------- because of this check
...
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:88:9
|
LL | if x.is_ok() {
| --------- because of this check
...
LL | x.unwrap();
| ^^^^^^^^^^
error: this call to `expect()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:91:9
|
LL | if x.is_ok() {
| --------- because of this check
...
LL | x.expect("an error message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: called `unwrap_err` on `x` after checking its variant with `is_ok`
--> tests/ui/checked_unwrap/simple_conditionals.rs:94:9
|
LL | if x.is_ok() {
2024-08-11 15:33:28 +00:00
| ------------ help: try: `if let Err(<item>) = x`
...
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:99:9
|
LL | if x.is_err() {
| ---------- because of this check
LL | // will panic
LL | x.unwrap();
| ^^^^^^^^^^
error: called `unwrap_err` on `x` after checking its variant with `is_err`
--> tests/ui/checked_unwrap/simple_conditionals.rs:102:9
|
LL | if x.is_err() {
2024-08-11 15:33:28 +00:00
| ------------- help: try: `if let Err(<item>) = x`
...
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: called `unwrap` on `x` after checking its variant with `is_err`
--> tests/ui/checked_unwrap/simple_conditionals.rs:106:9
|
LL | if x.is_err() {
2024-08-11 15:33:28 +00:00
| ------------- help: try: `if let Ok(<item>) = x`
...
LL | x.unwrap();
| ^^^^^^^^^^
error: this call to `unwrap_err()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:109:9
|
LL | if x.is_err() {
| ---------- because of this check
...
LL | x.unwrap_err();
| ^^^^^^^^^^^^^^
error: called `unwrap` on `option` after checking its variant with `is_some`
--> tests/ui/checked_unwrap/simple_conditionals.rs:134:9
|
LL | if option.is_some() {
2024-08-11 15:33:28 +00:00
| ------------------- help: try: `if let Some(<item>) = &option`
LL | option.as_ref().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:137:9
|
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`
--> tests/ui/checked_unwrap/simple_conditionals.rs:144:9
|
LL | if result.is_ok() {
2024-08-11 15:33:28 +00:00
| ----------------- help: try: `if let Ok(<item>) = &result`
LL | result.as_ref().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:147:9
|
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`
--> tests/ui/checked_unwrap/simple_conditionals.rs:153:9
|
LL | if option.is_some() {
2024-08-11 15:33:28 +00:00
| ------------------- help: try: `if let Some(<item>) = &mut option`
LL | option.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:156:9
|
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`
--> tests/ui/checked_unwrap/simple_conditionals.rs:162:9
|
LL | if result.is_ok() {
2024-08-11 15:33:28 +00:00
| ----------------- help: try: `if let Ok(<item>) = &mut result`
LL | result.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
--> tests/ui/checked_unwrap/simple_conditionals.rs:165:9
|
LL | if result.is_ok() {
| -------------- because of this check
...
LL | result.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 25 previous errors