@@ -114,5 +114,62 @@ error: using a reference to `Cow` is not recommended.
114
114
LL | fn test_cow_with_ref(c: &Cow<[i32]>) {}
115
115
| ^^^^^^^^^^^ help: change this to: `&[i32]`
116
116
117
- error: aborting due to 9 previous errors
117
+ error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices.
118
+ --> $DIR/ptr_arg.rs:143:21
119
+ |
120
+ LL | fn foo_vec(vec: &Vec<u8>) {
121
+ | ^^^^^^^^
122
+ |
123
+ help: change this to
124
+ |
125
+ LL | fn foo_vec(vec: &[u8]) {
126
+ | ^^^^^
127
+ help: change `vec.clone()` to
128
+ |
129
+ LL | let _ = vec.to_owned().pop();
130
+ | ^^^^^^^^^^^^^^
131
+ help: change `vec.clone()` to
132
+ |
133
+ LL | let _ = vec.to_owned().clone();
134
+ | ^^^^^^^^^^^^^^
135
+
136
+ error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do.
137
+ --> $DIR/ptr_arg.rs:148:23
138
+ |
139
+ LL | fn foo_path(path: &PathBuf) {
140
+ | ^^^^^^^^
141
+ |
142
+ help: change this to
143
+ |
144
+ LL | fn foo_path(path: &Path) {
145
+ | ^^^^^
146
+ help: change `path.clone()` to
147
+ |
148
+ LL | let _ = path.to_path_buf().pop();
149
+ | ^^^^^^^^^^^^^^^^^^
150
+ help: change `path.clone()` to
151
+ |
152
+ LL | let _ = path.to_path_buf().clone();
153
+ | ^^^^^^^^^^^^^^^^^^
154
+
155
+ error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do.
156
+ --> $DIR/ptr_arg.rs:153:21
157
+ |
158
+ LL | fn foo_str(str: &PathBuf) {
159
+ | ^^^^^^^^
160
+ |
161
+ help: change this to
162
+ |
163
+ LL | fn foo_str(str: &Path) {
164
+ | ^^^^^
165
+ help: change `str.clone()` to
166
+ |
167
+ LL | let _ = str.to_path_buf().pop();
168
+ | ^^^^^^^^^^^^^^^^^
169
+ help: change `str.clone()` to
170
+ |
171
+ LL | let _ = str.to_path_buf().clone();
172
+ | ^^^^^^^^^^^^^^^^^
173
+
174
+ error: aborting due to 12 previous errors
118
175
0 commit comments