summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/manual_unwrap_or.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/tools/clippy/tests/ui/manual_unwrap_or.stderr
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/clippy/tests/ui/manual_unwrap_or.stderr')
-rw-r--r--src/tools/clippy/tests/ui/manual_unwrap_or.stderr155
1 files changed, 155 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/manual_unwrap_or.stderr b/src/tools/clippy/tests/ui/manual_unwrap_or.stderr
new file mode 100644
index 000000000..0e4cb798d
--- /dev/null
+++ b/src/tools/clippy/tests/ui/manual_unwrap_or.stderr
@@ -0,0 +1,155 @@
+error: this pattern reimplements `Option::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:7:5
+ |
+LL | / match Some(1) {
+LL | | Some(i) => i,
+LL | | None => 42,
+LL | | };
+ | |_____^ help: replace with: `Some(1).unwrap_or(42)`
+ |
+ = note: `-D clippy::manual-unwrap-or` implied by `-D warnings`
+
+error: this pattern reimplements `Option::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:13:5
+ |
+LL | / match Some(1) {
+LL | | None => 42,
+LL | | Some(i) => i,
+LL | | };
+ | |_____^ help: replace with: `Some(1).unwrap_or(42)`
+
+error: this pattern reimplements `Option::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:19:5
+ |
+LL | / match Some(1) {
+LL | | Some(i) => i,
+LL | | None => 1 + 42,
+LL | | };
+ | |_____^ help: replace with: `Some(1).unwrap_or(1 + 42)`
+
+error: this pattern reimplements `Option::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:26:5
+ |
+LL | / match Some(1) {
+LL | | Some(i) => i,
+LL | | None => {
+LL | | 42 + 42
+... |
+LL | | }
+LL | | };
+ | |_____^
+ |
+help: replace with
+ |
+LL ~ Some(1).unwrap_or({
+LL + 42 + 42
+LL + + 42 + 42 + 42
+LL + + 42 + 42 + 42
+LL ~ });
+ |
+
+error: this pattern reimplements `Option::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:36:5
+ |
+LL | / match Some("Bob") {
+LL | | Some(i) => i,
+LL | | None => "Alice",
+LL | | };
+ | |_____^ help: replace with: `Some("Bob").unwrap_or("Alice")`
+
+error: this pattern reimplements `Result::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:86:5
+ |
+LL | / match Ok::<i32, &str>(1) {
+LL | | Ok(i) => i,
+LL | | Err(_) => 42,
+LL | | };
+ | |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(42)`
+
+error: this pattern reimplements `Result::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:93:5
+ |
+LL | / match a {
+LL | | Ok(i) => i,
+LL | | Err(_) => 42,
+LL | | };
+ | |_____^ help: replace with: `a.unwrap_or(42)`
+
+error: this pattern reimplements `Result::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:99:5
+ |
+LL | / match Ok(1) as Result<i32, &str> {
+LL | | Ok(i) => i,
+LL | | Err(_) => 42,
+LL | | };
+ | |_____^ help: replace with: `(Ok(1) as Result<i32, &str>).unwrap_or(42)`
+
+error: this pattern reimplements `Option::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:112:5
+ |
+LL | / match s.method() {
+LL | | Some(i) => i,
+LL | | None => 42,
+LL | | };
+ | |_____^ help: replace with: `s.method().unwrap_or(42)`
+
+error: this pattern reimplements `Result::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:118:5
+ |
+LL | / match Ok::<i32, &str>(1) {
+LL | | Err(_) => 42,
+LL | | Ok(i) => i,
+LL | | };
+ | |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(42)`
+
+error: this pattern reimplements `Result::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:124:5
+ |
+LL | / match Ok::<i32, &str>(1) {
+LL | | Ok(i) => i,
+LL | | Err(_) => 1 + 42,
+LL | | };
+ | |_____^ help: replace with: `Ok::<i32, &str>(1).unwrap_or(1 + 42)`
+
+error: this pattern reimplements `Result::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:131:5
+ |
+LL | / match Ok::<i32, &str>(1) {
+LL | | Ok(i) => i,
+LL | | Err(_) => {
+LL | | 42 + 42
+... |
+LL | | }
+LL | | };
+ | |_____^
+ |
+help: replace with
+ |
+LL ~ Ok::<i32, &str>(1).unwrap_or({
+LL + 42 + 42
+LL + + 42 + 42 + 42
+LL + + 42 + 42 + 42
+LL ~ });
+ |
+
+error: this pattern reimplements `Result::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:141:5
+ |
+LL | / match Ok::<&str, &str>("Bob") {
+LL | | Ok(i) => i,
+LL | | Err(_) => "Alice",
+LL | | };
+ | |_____^ help: replace with: `Ok::<&str, &str>("Bob").unwrap_or("Alice")`
+
+error: this pattern reimplements `Option::unwrap_or`
+ --> $DIR/manual_unwrap_or.rs:201:17
+ |
+LL | let _ = match some_macro!() {
+ | _________________^
+LL | | Some(val) => val,
+LL | | None => 0,
+LL | | };
+ | |_________^ help: replace with: `some_macro!().unwrap_or(0)`
+
+error: aborting due to 14 previous errors
+