]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/tests/ui/option_if_let_else.stderr
Rollup merge of #89876 - AlexApps99:const_ops, r=oli-obk
[rust.git] / src / tools / clippy / tests / ui / option_if_let_else.stderr
index 4ebb068d22ed52bd3de3a674f214639aad6417fc..803d941c36df8b2d8aa80ca7fa381ee8c35c780a 100644 (file)
@@ -36,10 +36,10 @@ LL | |     };
    |
 help: try
    |
-LL |     let _ = num.as_mut().map_or(&mut 0, |s| {
-LL |         *s += 1;
-LL |         s
-LL |     });
+LL ~     let _ = num.as_mut().map_or(&mut 0, |s| {
+LL +         *s += 1;
+LL +         s
+LL ~     });
    |
 
 error: use Option::map_or instead of an if let/else
@@ -62,10 +62,10 @@ LL | |     };
    |
 help: try
    |
-LL |     let _ = num.map_or(0, |mut s| {
-LL |         s += 1;
-LL |         s
-LL |     });
+LL ~     let _ = num.map_or(0, |mut s| {
+LL +         s += 1;
+LL +         s
+LL ~     });
    |
 
 error: use Option::map_or instead of an if let/else
@@ -82,10 +82,10 @@ LL | |     };
    |
 help: try
    |
-LL |     let _ = num.as_mut().map_or(&mut 0, |s| {
-LL |         *s += 1;
-LL |         s
-LL |     });
+LL ~     let _ = num.as_mut().map_or(&mut 0, |s| {
+LL +         *s += 1;
+LL +         s
+LL ~     });
    |
 
 error: use Option::map_or instead of an if let/else
@@ -101,10 +101,10 @@ LL | |     }
    |
 help: try
    |
-LL |     arg.map_or(13, |x| {
-LL |         let y = x * x;
-LL |         y * y
-LL |     })
+LL ~     arg.map_or(13, |x| {
+LL +         let y = x * x;
+LL +         y * y
+LL +     })
    |
 
 error: use Option::map_or_else instead of an if let/else
@@ -134,12 +134,12 @@ LL | |     };
    |
 help: try
    |
-LL |     let _ = arg.map_or_else(|| {
-LL |         let mut y = 1;
-LL |         y = (y + 2 / y) / 2;
-LL |         y = (y + 2 / y) / 2;
-LL |         y
-LL |     }, |x| x * x * x * x);
+LL ~     let _ = arg.map_or_else(|| {
+LL +         let mut y = 1;
+LL +         y = (y + 2 / y) / 2;
+LL +         y = (y + 2 / y) / 2;
+LL +         y
+LL ~     }, |x| x * x * x * x);
    |
 
 error: use Option::map_or instead of an if let/else
@@ -148,5 +148,53 @@ error: use Option::map_or instead of an if let/else
 LL |     let _ = if let Some(x) = optional { x + 2 } else { 5 };
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `optional.map_or(5, |x| x + 2)`
 
-error: aborting due to 11 previous errors
+error: use Option::map_or instead of an if let/else
+  --> $DIR/option_if_let_else.rs:109:13
+   |
+LL |       let _ = if let Some(x) = Some(0) {
+   |  _____________^
+LL | |         loop {
+LL | |             if x == 0 {
+LL | |                 break x;
+...  |
+LL | |         0
+LL | |     };
+   | |_____^
+   |
+help: try
+   |
+LL ~     let _ = Some(0).map_or(0, |x| loop {
+LL +             if x == 0 {
+LL +                 break x;
+LL +             }
+LL ~         });
+   |
+
+error: use Option::map_or_else instead of an if let/else
+  --> $DIR/option_if_let_else.rs:137:13
+   |
+LL |     let _ = if let Some(x) = Some(0) { s.len() + x } else { s.len() };
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Some(0).map_or_else(|| s.len(), |x| s.len() + x)`
+
+error: use Option::map_or instead of an if let/else
+  --> $DIR/option_if_let_else.rs:141:13
+   |
+LL |       let _ = if let Some(x) = Some(0) {
+   |  _____________^
+LL | |         let s = s;
+LL | |         s.len() + x
+LL | |     } else {
+LL | |         1
+LL | |     };
+   | |_____^
+   |
+help: try
+   |
+LL ~     let _ = Some(0).map_or(1, |x| {
+LL +         let s = s;
+LL +         s.len() + x
+LL ~     });
+   |
+
+error: aborting due to 14 previous errors