2021-09-08 09:31:47 -05:00
error: called `unwrap` on `x` after checking its variant with `is_some`
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:46:9
2019-07-15 14:27:44 -05:00
|
LL | if x.is_some() {
2024-08-24 16:34:45 -05:00
| -------------- help: try: `if let Some(<item>) = x`
2023-08-24 14:32:12 -05:00
LL | // unnecessary
LL | x.unwrap();
2019-07-15 14:27:44 -05:00
| ^^^^^^^^^^
|
2020-01-31 13:21:10 -06:00
note: the lint level is defined here
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:2:35
2019-07-15 14:27:44 -05:00
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
2021-09-08 09:31:47 -05:00
error: called `expect` on `x` after checking its variant with `is_some`
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:49:9
2021-09-08 09:31:47 -05:00
|
LL | if x.is_some() {
2024-08-24 16:34:45 -05:00
| -------------- help: try: `if let Some(<item>) = x`
2023-08-24 14:32:12 -05:00
...
LL | x.expect("an error message");
2021-09-08 09:31:47 -05:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020-08-11 08:43:21 -05:00
error: this call to `unwrap()` will always panic
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:53:9
2019-07-15 14:27:44 -05:00
|
LL | if x.is_some() {
| ----------- because of this check
...
2023-08-24 14:32:12 -05:00
LL | x.unwrap();
2019-07-15 14:27:44 -05:00
| ^^^^^^^^^^
|
2020-01-31 13:21:10 -06:00
note: the lint level is defined here
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:2:9
2019-07-15 14:27:44 -05:00
|
LL | #![deny(clippy::panicking_unwrap, clippy::unnecessary_unwrap)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
2021-09-08 09:31:47 -05:00
error: this call to `expect()` will always panic
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:56:9
2021-09-08 09:31:47 -05:00
|
LL | if x.is_some() {
| ----------- because of this check
...
2023-08-24 14:32:12 -05:00
LL | x.expect("an error message");
2021-09-08 09:31:47 -05:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020-08-11 08:43:21 -05:00
error: this call to `unwrap()` will always panic
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:61:9
2019-07-15 14:27:44 -05:00
|
LL | if x.is_none() {
| ----------- because of this check
2023-08-24 14:32:12 -05:00
LL | // will panic
LL | x.unwrap();
2019-07-15 14:27:44 -05:00
| ^^^^^^^^^^
2021-09-08 09:31:47 -05:00
error: called `unwrap` on `x` after checking its variant with `is_none`
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:65:9
2019-07-15 14:27:44 -05:00
|
LL | if x.is_none() {
2024-08-24 16:34:45 -05:00
| -------------- help: try: `if let Some(<item>) = x`
2019-07-15 14:27:44 -05:00
...
2023-08-24 14:32:12 -05:00
LL | x.unwrap();
2019-07-15 14:27:44 -05:00
| ^^^^^^^^^^
2021-09-08 09:31:47 -05:00
error: called `unwrap` on `x` after checking its variant with `is_some`
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:13:13
2020-02-04 14:38:26 -06:00
|
LL | if $a.is_some() {
2024-08-24 16:34:45 -05:00
| --------------- help: try: `if let Some(<item>) = x`
2023-08-24 14:32:12 -05:00
LL | // unnecessary
LL | $a.unwrap();
2020-02-04 14:38:26 -06:00
| ^^^^^^^^^^^
...
LL | m!(x);
2021-10-14 13:28:30 -05:00
| ----- in this macro invocation
2020-02-06 21:34:06 -06:00
|
2021-02-13 13:52:25 -06:00
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
2020-02-04 14:38:26 -06:00
2021-09-08 09:31:47 -05:00
error: called `unwrap` on `x` after checking its variant with `is_ok`
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:78:9
2019-07-15 14:27:44 -05:00
|
LL | if x.is_ok() {
2024-08-24 16:34:45 -05:00
| ------------ help: try: `if let Ok(<item>) = x`
2023-08-24 14:32:12 -05:00
LL | // unnecessary
LL | x.unwrap();
2019-07-15 14:27:44 -05:00
| ^^^^^^^^^^
2021-09-08 09:31:47 -05:00
error: called `expect` on `x` after checking its variant with `is_ok`
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:81:9
2021-09-08 09:31:47 -05:00
|
LL | if x.is_ok() {
2024-08-24 16:34:45 -05:00
| ------------ help: try: `if let Ok(<item>) = x`
2023-08-24 14:32:12 -05:00
...
LL | x.expect("an error message");
2021-09-08 09:31:47 -05:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020-08-11 08:43:21 -05:00
error: this call to `unwrap_err()` will always panic
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:84:9
2019-07-15 14:27:44 -05:00
|
LL | if x.is_ok() {
| --------- because of this check
2021-09-08 09:31:47 -05:00
...
2023-08-24 14:32:12 -05:00
LL | x.unwrap_err();
2019-07-15 14:27:44 -05:00
| ^^^^^^^^^^^^^^
2020-08-11 08:43:21 -05:00
error: this call to `unwrap()` will always panic
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:88:9
2019-07-15 14:27:44 -05:00
|
LL | if x.is_ok() {
| --------- because of this check
...
2023-08-24 14:32:12 -05:00
LL | x.unwrap();
2019-07-15 14:27:44 -05:00
| ^^^^^^^^^^
2021-09-08 09:31:47 -05:00
error: this call to `expect()` will always panic
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:91:9
2021-09-08 09:31:47 -05:00
|
LL | if x.is_ok() {
| --------- because of this check
...
2023-08-24 14:32:12 -05:00
LL | x.expect("an error message");
2021-09-08 09:31:47 -05:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: called `unwrap_err` on `x` after checking its variant with `is_ok`
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:94:9
2019-07-15 14:27:44 -05:00
|
LL | if x.is_ok() {
2024-08-24 16:34:45 -05:00
| ------------ help: try: `if let Err(<item>) = x`
2019-07-15 14:27:44 -05:00
...
2023-08-24 14:32:12 -05:00
LL | x.unwrap_err();
2019-07-15 14:27:44 -05:00
| ^^^^^^^^^^^^^^
2020-08-11 08:43:21 -05:00
error: this call to `unwrap()` will always panic
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:99:9
2019-07-15 14:27:44 -05:00
|
LL | if x.is_err() {
| ---------- because of this check
2023-08-24 14:32:12 -05:00
LL | // will panic
LL | x.unwrap();
2019-07-15 14:27:44 -05:00
| ^^^^^^^^^^
2021-09-08 09:31:47 -05:00
error: called `unwrap_err` on `x` after checking its variant with `is_err`
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:102:9
2019-07-15 14:27:44 -05:00
|
LL | if x.is_err() {
2024-08-24 16:34:45 -05:00
| ------------- help: try: `if let Err(<item>) = x`
2023-08-24 14:32:12 -05:00
...
LL | x.unwrap_err();
2019-07-15 14:27:44 -05:00
| ^^^^^^^^^^^^^^
2021-09-08 09:31:47 -05:00
error: called `unwrap` on `x` after checking its variant with `is_err`
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:106:9
2019-07-15 14:27:44 -05:00
|
LL | if x.is_err() {
2024-08-24 16:34:45 -05:00
| ------------- help: try: `if let Ok(<item>) = x`
2019-07-15 14:27:44 -05:00
...
2023-08-24 14:32:12 -05:00
LL | x.unwrap();
2019-07-15 14:27:44 -05:00
| ^^^^^^^^^^
2020-08-11 08:43:21 -05:00
error: this call to `unwrap_err()` will always panic
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:109:9
2019-07-15 14:27:44 -05:00
|
LL | if x.is_err() {
| ---------- because of this check
...
2023-08-24 14:32:12 -05:00
LL | x.unwrap_err();
2019-07-15 14:27:44 -05:00
| ^^^^^^^^^^^^^^
2023-09-12 11:13:53 -05:00
error: called `unwrap` on `option` after checking its variant with `is_some`
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:134:9
2023-09-12 11:13:53 -05:00
|
LL | if option.is_some() {
2024-08-24 16:34:45 -05:00
| ------------------- help: try: `if let Some(<item>) = &option`
2023-09-12 11:13:53 -05:00
LL | option.as_ref().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:137:9
2023-09-12 11:13:53 -05: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-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:144:9
2023-09-12 11:13:53 -05:00
|
LL | if result.is_ok() {
2024-08-24 16:34:45 -05:00
| ----------------- help: try: `if let Ok(<item>) = &result`
2023-09-12 11:13:53 -05:00
LL | result.as_ref().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:147:9
2023-09-12 11:13:53 -05: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-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:153:9
2023-09-12 11:13:53 -05:00
|
LL | if option.is_some() {
2024-08-24 16:34:45 -05:00
| ------------------- help: try: `if let Some(<item>) = &mut option`
2023-09-12 11:13:53 -05:00
LL | option.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:156:9
2023-09-12 11:13:53 -05: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-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:162:9
2023-09-12 11:13:53 -05:00
|
LL | if result.is_ok() {
2024-08-24 16:34:45 -05:00
| ----------------- help: try: `if let Ok(<item>) = &mut result`
2023-09-12 11:13:53 -05:00
LL | result.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: this call to `unwrap()` will always panic
2024-02-10 16:31:36 -06:00
--> tests/ui/checked_unwrap/simple_conditionals.rs:165:9
2023-09-12 11:13:53 -05:00
|
LL | if result.is_ok() {
| -------------- because of this check
...
LL | result.as_mut().unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-23 22:49:09 -05:00
error: creating a shared reference to mutable static is discouraged
--> tests/ui/checked_unwrap/simple_conditionals.rs:174:12
|
LL | if X.is_some() {
| ^^^^^^^^^^^ shared reference to mutable static
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
= note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
= note: `-D static-mut-refs` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(static_mut_refs)]`
error: aborting due to 26 previous errors
2019-07-15 14:27:44 -05:00