error: used `unwrap()` on `Some` value --> $DIR/unnecessary_literal_unwrap.rs:7:16 | LL | let _val = Some(1).unwrap(); | ^^^^^^^^^^^^^^^^ | = note: `-D clippy::unnecessary-literal-unwrap` implied by `-D warnings` help: remove the `Some` and `unwrap()` | LL - let _val = Some(1).unwrap(); LL + let _val = 1; | error: used `expect()` on `Some` value --> $DIR/unnecessary_literal_unwrap.rs:8:16 | LL | let _val = Some(1).expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `expect()` | LL - let _val = Some(1).expect("this never happens"); LL + let _val = 1; | error: used `unwrap()` on `None` value --> $DIR/unnecessary_literal_unwrap.rs:12:5 | LL | None::.unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^ help: remove the `None` and `unwrap()`: `panic!()` error: used `expect()` on `None` value --> $DIR/unnecessary_literal_unwrap.rs:13:5 | LL | None::.expect("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `None` and `expect()` | LL | panic!("this always happens"); | ~~~~~~~ ~ error: used `unwrap()` on `Ok` value --> $DIR/unnecessary_literal_unwrap.rs:17:16 | LL | let _val = Ok::(1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap()` | LL - let _val = Ok::(1).unwrap(); LL + let _val = 1; | error: used `expect()` on `Ok` value --> $DIR/unnecessary_literal_unwrap.rs:18:16 | LL | let _val = Ok::(1).expect("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `expect()` | LL - let _val = Ok::(1).expect("this never happens"); LL + let _val = 1; | error: used `unwrap_err()` on `Ok` value --> $DIR/unnecessary_literal_unwrap.rs:19:5 | LL | Ok::(1).unwrap_err(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_err()` | LL | panic!("{:?}", 1); | ~~~~~~~~~~~~~~ ~ error: used `expect_err()` on `Ok` value --> $DIR/unnecessary_literal_unwrap.rs:20:5 | LL | Ok::(1).expect_err("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `expect_err()` | LL | panic!("{1}: {:?}", 1, "this always happens"); | ~~~~~~~~~~~~~~~~~~~ ~ error: used `unwrap_err()` on `Err` value --> $DIR/unnecessary_literal_unwrap.rs:24:16 | LL | let _val = Err::<(), usize>(1).unwrap_err(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Err` and `unwrap_err()` | LL - let _val = Err::<(), usize>(1).unwrap_err(); LL + let _val = 1; | error: used `expect_err()` on `Err` value --> $DIR/unnecessary_literal_unwrap.rs:25:16 | LL | let _val = Err::<(), usize>(1).expect_err("this never happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Err` and `expect_err()` | LL - let _val = Err::<(), usize>(1).expect_err("this never happens"); LL + let _val = 1; | error: used `unwrap()` on `Err` value --> $DIR/unnecessary_literal_unwrap.rs:26:5 | LL | Err::<(), usize>(1).unwrap(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Err` and `unwrap()` | LL | panic!("{:?}", 1); | ~~~~~~~~~~~~~~ ~ error: used `expect()` on `Err` value --> $DIR/unnecessary_literal_unwrap.rs:27:5 | LL | Err::<(), usize>(1).expect("this always happens"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Err` and `expect()` | LL | panic!("{1}: {:?}", 1, "this always happens"); | ~~~~~~~~~~~~~~~~~~~ ~ error: used `unwrap_or()` on `Some` value --> $DIR/unnecessary_literal_unwrap.rs:31:16 | LL | let _val = Some(1).unwrap_or(2); | ^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `unwrap_or()` | LL - let _val = Some(1).unwrap_or(2); LL + let _val = 1; | error: used `unwrap_or_default()` on `Some` value --> $DIR/unnecessary_literal_unwrap.rs:32:16 | LL | let _val = Some(1).unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `unwrap_or_default()` | LL - let _val = Some(1).unwrap_or_default(); LL + let _val = 1; | error: used `unwrap_or_else()` on `Some` value --> $DIR/unnecessary_literal_unwrap.rs:33:16 | LL | let _val = Some(1).unwrap_or_else(|| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Some` and `unwrap_or_else()` | LL - let _val = Some(1).unwrap_or_else(|| 2); LL + let _val = 1; | error: used `unwrap_or()` on `Ok` value --> $DIR/unnecessary_literal_unwrap.rs:37:16 | LL | let _val = Ok::(1).unwrap_or(2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_or()` | LL - let _val = Ok::(1).unwrap_or(2); LL + let _val = 1; | error: used `unwrap_or_default()` on `Ok` value --> $DIR/unnecessary_literal_unwrap.rs:38:16 | LL | let _val = Ok::(1).unwrap_or_default(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_or_default()` | LL - let _val = Ok::(1).unwrap_or_default(); LL + let _val = 1; | error: used `unwrap_or_else()` on `Ok` value --> $DIR/unnecessary_literal_unwrap.rs:39:16 | LL | let _val = Ok::(1).unwrap_or_else(|_| 2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove the `Ok` and `unwrap_or_else()` | LL - let _val = Ok::(1).unwrap_or_else(|_| 2); LL + let _val = 1; | error: aborting due to 18 previous errors