You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/ui/option_as_ref_deref.stderr
+10-38Lines changed: 10 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -64,47 +64,19 @@ error: called `.as_ref().map(PathBuf::as_path)` on an Option value. This can be
64
64
LL | let _ = Some(PathBuf::new()).as_ref().map(PathBuf::as_path);
65
65
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(PathBuf::new()).as_deref()`
66
66
67
-
error: called `.as_ref().map(Vec::as_slice)` on an Option value. This can be done more directly by calling `Some(Vec::<()>::new()).as_deref()` instead
68
-
--> $DIR/option_as_ref_deref.rs:31:13
69
-
|
70
-
LL | let _ = Some(Vec::<()>::new()).as_ref().map(Vec::as_slice);
71
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(Vec::<()>::new()).as_deref()`
67
+
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', clippy_lints/src/path_from_format.rs:39:41
68
+
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
72
69
73
-
error: called `.as_mut().map(Vec::as_mut_slice)` on an Option value. This can be done more directly by calling `Some(Vec::<()>::new()).as_deref_mut()` instead
74
-
--> $DIR/option_as_ref_deref.rs:32:13
75
-
|
76
-
LL | let _ = Some(Vec::<()>::new()).as_mut().map(Vec::as_mut_slice);
77
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `Some(Vec::<()>::new()).as_deref_mut()`
70
+
error: internal compiler error: unexpected panic
78
71
79
-
error: called `.as_ref().map(|x| x.deref())` on an Option value. This can be done more directly by calling `opt.as_deref()` instead
80
-
--> $DIR/option_as_ref_deref.rs:34:13
81
-
|
82
-
LL | let _ = opt.as_ref().map(|x| x.deref());
83
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
72
+
note: the compiler unexpectedly panicked. this is a bug.
84
73
85
-
error: called `.as_mut().map(|x| x.deref_mut())` on an Option value. This can be done more directly by calling `opt.clone().as_deref_mut()` instead
86
-
--> $DIR/option_as_ref_deref.rs:35:13
87
-
|
88
-
LL | let _ = opt.clone().as_mut().map(|x| x.deref_mut()).map(|x| x.len());
89
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.clone().as_deref_mut()`
74
+
note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new
90
75
91
-
error: called `.as_ref().map(|x| &**x)` on an Option value. This can be done more directly by calling `opt.as_deref()` instead
92
-
--> $DIR/option_as_ref_deref.rs:42:13
93
-
|
94
-
LL | let _ = opt.as_ref().map(|x| &**x);
95
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
96
-
97
-
error: called `.as_mut().map(|x| &mut **x)` on an Option value. This can be done more directly by calling `opt.as_deref_mut()` instead
98
-
--> $DIR/option_as_ref_deref.rs:43:13
99
-
|
100
-
LL | let _ = opt.as_mut().map(|x| &mut **x);
101
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
102
-
103
-
error: called `.as_ref().map(std::ops::Deref::deref)` on an Option value. This can be done more directly by calling `opt.as_deref()` instead
104
-
--> $DIR/option_as_ref_deref.rs:46:13
105
-
|
106
-
LL | let _ = opt.as_ref().map(std::ops::Deref::deref);
107
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.join()` to avoid the extra allocation: `Path::new(base_path1).join("foo").join("bar")`
6
6
|
7
7
= note: `-D clippy::path-from-format` implied by `-D warnings`
0 commit comments