]> git.lizzy.rs Git - rust.git/blob - tests/ui/option_as_ref_deref.stderr
Auto merge of #4809 - iankronquist:patch-1, r=flip1995
[rust.git] / tests / ui / option_as_ref_deref.stderr
1 error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.clone().as_deref()` instead
2   --> $DIR/option_as_ref_deref.rs:13:13
3    |
4 LL |     let _ = opt.clone().as_ref().map(Deref::deref).map(str::len);
5    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.clone().as_deref()`
6    |
7    = note: `-D clippy::option-as-ref-deref` implied by `-D warnings`
8
9 error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.clone().as_deref()` instead
10   --> $DIR/option_as_ref_deref.rs:16:13
11    |
12 LL |       let _ = opt.clone()
13    |  _____________^
14 LL | |         .as_ref().map(
15 LL | |             Deref::deref
16 LL | |         )
17    | |_________^ help: try using as_deref instead: `opt.clone().as_deref()`
18
19 error: called `.as_mut().map(DerefMut::deref_mut)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.as_deref_mut()` instead
20   --> $DIR/option_as_ref_deref.rs:22:13
21    |
22 LL |     let _ = opt.as_mut().map(DerefMut::deref_mut);
23    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
24
25 error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.as_deref()` instead
26   --> $DIR/option_as_ref_deref.rs:24:13
27    |
28 LL |     let _ = opt.as_ref().map(String::as_str);
29    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
30
31 error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.as_deref()` instead
32   --> $DIR/option_as_ref_deref.rs:25:13
33    |
34 LL |     let _ = opt.as_ref().map(|x| x.as_str());
35    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
36
37 error: called `.as_mut().map(DerefMut::deref_mut)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.as_deref_mut()` instead
38   --> $DIR/option_as_ref_deref.rs:26:13
39    |
40 LL |     let _ = opt.as_mut().map(String::as_mut_str);
41    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
42
43 error: called `.as_mut().map(DerefMut::deref_mut)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `opt.as_deref_mut()` instead
44   --> $DIR/option_as_ref_deref.rs:27:13
45    |
46 LL |     let _ = opt.as_mut().map(|x| x.as_mut_str());
47    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
48
49 error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `Some(CString::new(vec![]).unwrap()).as_deref()` instead
50   --> $DIR/option_as_ref_deref.rs:28:13
51    |
52 LL |     let _ = Some(CString::new(vec![]).unwrap()).as_ref().map(CString::as_c_str);
53    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(CString::new(vec![]).unwrap()).as_deref()`
54
55 error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `Some(OsString::new()).as_deref()` instead
56   --> $DIR/option_as_ref_deref.rs:29:13
57    |
58 LL |     let _ = Some(OsString::new()).as_ref().map(OsString::as_os_str);
59    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(OsString::new()).as_deref()`
60
61 error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) on an Option value. This can be done more directly by calling `Some(PathBuf::new()).as_deref()` instead
62   --> $DIR/option_as_ref_deref.rs:30:13
63    |
64 LL |     let _ = Some(PathBuf::new()).as_ref().map(PathBuf::as_path);
65    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(PathBuf::new()).as_deref()`
66
67 error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) 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()`
72
73 error: called `.as_mut().map(DerefMut::deref_mut)` (or with one of deref aliases) 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()`
78
79 error: called `.as_ref().map(Deref::deref)` (or with one of deref aliases) 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()`
84
85 error: called `.as_mut().map(DerefMut::deref_mut)` (or with one of deref aliases) 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()`
90
91 error: aborting due to 14 previous errors
92