11error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
2- --> $DIR/ptr_arg.rs:12 :14
2+ --> $DIR/ptr_arg.rs:7 :14
33 |
44LL | fn do_vec(x: &Vec<i64>) {
55 | ^^^^^^^^^ help: change this to: `&[i64]`
66 |
77 = note: `-D clippy::ptr-arg` implied by `-D warnings`
88
99error: writing `&String` instead of `&str` involves a new object where a slice will do
10- --> $DIR/ptr_arg.rs:21 :14
10+ --> $DIR/ptr_arg.rs:16 :14
1111 |
1212LL | fn do_str(x: &String) {
1313 | ^^^^^^^ help: change this to: `&str`
1414
1515error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
16- --> $DIR/ptr_arg.rs:30 :15
16+ --> $DIR/ptr_arg.rs:25 :15
1717 |
1818LL | fn do_path(x: &PathBuf) {
1919 | ^^^^^^^^ help: change this to: `&Path`
2020
2121error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
22- --> $DIR/ptr_arg.rs:43 :18
22+ --> $DIR/ptr_arg.rs:38 :18
2323 |
2424LL | fn do_vec(x: &Vec<i64>);
2525 | ^^^^^^^^^ help: change this to: `&[i64]`
2626
2727error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
28- --> $DIR/ptr_arg.rs:56 :14
28+ --> $DIR/ptr_arg.rs:51 :14
2929 |
3030LL | fn cloned(x: &Vec<u8>) -> Vec<u8> {
3131 | ^^^^^^^^
@@ -44,7 +44,7 @@ LL | x.to_owned()
4444 |
4545
4646error: writing `&String` instead of `&str` involves a new object where a slice will do
47- --> $DIR/ptr_arg.rs:65 :18
47+ --> $DIR/ptr_arg.rs:60 :18
4848 |
4949LL | fn str_cloned(x: &String) -> String {
5050 | ^^^^^^^
@@ -67,7 +67,7 @@ LL | x.to_string()
6767 |
6868
6969error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
70- --> $DIR/ptr_arg.rs:73 :19
70+ --> $DIR/ptr_arg.rs:68 :19
7171 |
7272LL | fn path_cloned(x: &PathBuf) -> PathBuf {
7373 | ^^^^^^^^
@@ -90,7 +90,7 @@ LL | x.to_path_buf()
9090 |
9191
9292error: writing `&String` instead of `&str` involves a new object where a slice will do
93- --> $DIR/ptr_arg.rs:81 :44
93+ --> $DIR/ptr_arg.rs:76 :44
9494 |
9595LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
9696 | ^^^^^^^
@@ -109,13 +109,13 @@ LL | let c = y;
109109 | ~
110110
111111error: using a reference to `Cow` is not recommended
112- --> $DIR/ptr_arg.rs:95 :25
112+ --> $DIR/ptr_arg.rs:90 :25
113113 |
114114LL | fn test_cow_with_ref(c: &Cow<[i32]>) {}
115115 | ^^^^^^^^^^^ help: change this to: `&[i32]`
116116
117117error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
118- --> $DIR/ptr_arg.rs:148 :21
118+ --> $DIR/ptr_arg.rs:143 :21
119119 |
120120LL | fn foo_vec(vec: &Vec<u8>) {
121121 | ^^^^^^^^
@@ -134,7 +134,7 @@ LL | let _ = vec.to_owned().clone();
134134 | ~~~~~~~~~~~~~~
135135
136136error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
137- --> $DIR/ptr_arg.rs:153 :23
137+ --> $DIR/ptr_arg.rs:148 :23
138138 |
139139LL | fn foo_path(path: &PathBuf) {
140140 | ^^^^^^^^
@@ -153,7 +153,7 @@ LL | let _ = path.to_path_buf().clone();
153153 | ~~~~~~~~~~~~~~~~~~
154154
155155error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
156- --> $DIR/ptr_arg.rs:158 :21
156+ --> $DIR/ptr_arg.rs:153 :21
157157 |
158158LL | fn foo_str(str: &PathBuf) {
159159 | ^^^^^^^^
0 commit comments