From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/tools/clippy/tests/ui/or_then_unwrap.stderr | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/tools/clippy/tests/ui/or_then_unwrap.stderr (limited to 'src/tools/clippy/tests/ui/or_then_unwrap.stderr') diff --git a/src/tools/clippy/tests/ui/or_then_unwrap.stderr b/src/tools/clippy/tests/ui/or_then_unwrap.stderr new file mode 100644 index 000000000..da88154c5 --- /dev/null +++ b/src/tools/clippy/tests/ui/or_then_unwrap.stderr @@ -0,0 +1,22 @@ +error: found `.or(Some(…)).unwrap()` + --> $DIR/or_then_unwrap.rs:24:20 + | +LL | let _ = option.or(Some("fallback")).unwrap(); // should trigger lint + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or("fallback")` + | + = note: `-D clippy::or-then-unwrap` implied by `-D warnings` + +error: found `.or(Ok(…)).unwrap()` + --> $DIR/or_then_unwrap.rs:27:20 + | +LL | let _ = result.or::<&str>(Ok("fallback")).unwrap(); // should trigger lint + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or("fallback")` + +error: found `.or(Some(…)).unwrap()` + --> $DIR/or_then_unwrap.rs:31:31 + | +LL | let _ = option.map(|v| v).or(Some("fallback")).unwrap().to_string().chars(); // should trigger lint + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or("fallback")` + +error: aborting due to 3 previous errors + -- cgit v1.2.3