File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -21,14 +21,14 @@ pub(super) fn check<'tcx>(
2121 let or_arg_content: Span ;
2222
2323 if is_type_diagnostic_item ( cx, ty, sym:: Option ) {
24- title = ".or(Some(…)).unwrap() found " ;
24+ title = "found ` .or(Some(…)).unwrap()` " ;
2525 if let Some ( content) = get_content_if_is ( or_arg, "Some" ) {
2626 or_arg_content = content;
2727 } else {
2828 return ;
2929 }
3030 } else if is_type_diagnostic_item ( cx, ty, sym:: Result ) {
31- title = ".or(Ok(…)).unwrap() found " ;
31+ title = "found ` .or(Ok(…)).unwrap()` " ;
3232 if let Some ( content) = get_content_if_is ( or_arg, "Ok" ) {
3333 or_arg_content = content;
3434 } else {
Original file line number Diff line number Diff line change 1- error: .or(Some(…)).unwrap() found
1+ error: found ` .or(Some(…)).unwrap()`
22 --> $DIR/or_then_unwrap.rs:24:20
33 |
44LL | let _ = option.or(Some("fallback")).unwrap(); // should trigger lint
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or("fallback")`
66 |
77 = note: `-D clippy::or-then-unwrap` implied by `-D warnings`
88
9- error: .or(Ok(…)).unwrap() found
9+ error: found ` .or(Ok(…)).unwrap()`
1010 --> $DIR/or_then_unwrap.rs:27:20
1111 |
1212LL | let _ = result.or::<&str>(Ok("fallback")).unwrap(); // should trigger lint
1313 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or("fallback")`
1414
15- error: .or(Some(…)).unwrap() found
15+ error: found ` .or(Some(…)).unwrap()`
1616 --> $DIR/or_then_unwrap.rs:31:31
1717 |
1818LL | let _ = option.map(|v| v).or(Some("fallback")).unwrap().to_string().chars(); // should trigger lint
You can’t perform that action at this time.
0 commit comments