1 error: called `.as_ref().map(Deref::deref)` 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
4 LL | let _ = opt.clone().as_ref().map(Deref::deref).map(str::len);
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.clone().as_deref()`
7 = note: `-D clippy::option-as-ref-deref` implied by `-D warnings`
9 error: called `.as_ref().map(Deref::deref)` 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
12 LL | let _ = opt.clone()
17 | |_________^ help: try using as_deref instead: `opt.clone().as_deref()`
19 error: called `.as_mut().map(DerefMut::deref_mut)` 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
22 LL | let _ = opt.as_mut().map(DerefMut::deref_mut);
23 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
25 error: called `.as_ref().map(String::as_str)` 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
28 LL | let _ = opt.as_ref().map(String::as_str);
29 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
31 error: called `.as_ref().map(|x| x.as_str())` 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
34 LL | let _ = opt.as_ref().map(|x| x.as_str());
35 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
37 error: called `.as_mut().map(String::as_mut_str)` 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
40 LL | let _ = opt.as_mut().map(String::as_mut_str);
41 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
43 error: called `.as_mut().map(|x| x.as_mut_str())` 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
46 LL | let _ = opt.as_mut().map(|x| x.as_mut_str());
47 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
49 error: called `.as_ref().map(CString::as_c_str)` 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
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()`
55 error: called `.as_ref().map(OsString::as_os_str)` 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
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()`
61 error: called `.as_ref().map(PathBuf::as_path)` 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
64 LL | let _ = Some(PathBuf::new()).as_ref().map(PathBuf::as_path);
65 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(PathBuf::new()).as_deref()`
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
70 LL | let _ = Some(Vec::<()>::new()).as_ref().map(Vec::as_slice);
71 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `Some(Vec::<()>::new()).as_deref()`
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
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()`
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
82 LL | let _ = opt.as_ref().map(|x| x.deref());
83 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
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
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()`
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
94 LL | let _ = opt.as_ref().map(|x| &**x);
95 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
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
100 LL | let _ = opt.as_mut().map(|x| &mut **x);
101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref_mut instead: `opt.as_deref_mut()`
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
106 LL | let _ = opt.as_ref().map(std::ops::Deref::deref);
107 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: `opt.as_deref()`
109 error: aborting due to 17 previous errors