1
1
error: 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
3
3
|
4
4
LL | fn do_vec(x: &Vec<i64>) {
5
5
| ^^^^^^^^^ help: change this to: `&[i64]`
6
6
|
7
7
= note: `-D clippy::ptr-arg` implied by `-D warnings`
8
8
9
9
error: 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
11
11
|
12
12
LL | fn do_str(x: &String) {
13
13
| ^^^^^^^ help: change this to: `&str`
14
14
15
15
error: 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
17
17
|
18
18
LL | fn do_path(x: &PathBuf) {
19
19
| ^^^^^^^^ help: change this to: `&Path`
20
20
21
21
error: 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
23
23
|
24
24
LL | fn do_vec(x: &Vec<i64>);
25
25
| ^^^^^^^^^ help: change this to: `&[i64]`
26
26
27
27
error: 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
29
29
|
30
30
LL | fn cloned(x: &Vec<u8>) -> Vec<u8> {
31
31
| ^^^^^^^^
@@ -44,7 +44,7 @@ LL | x.to_owned()
44
44
|
45
45
46
46
error: 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
48
48
|
49
49
LL | fn str_cloned(x: &String) -> String {
50
50
| ^^^^^^^
@@ -67,7 +67,7 @@ LL | x.to_string()
67
67
|
68
68
69
69
error: 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
71
71
|
72
72
LL | fn path_cloned(x: &PathBuf) -> PathBuf {
73
73
| ^^^^^^^^
@@ -90,7 +90,7 @@ LL | x.to_path_buf()
90
90
|
91
91
92
92
error: 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
94
94
|
95
95
LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
96
96
| ^^^^^^^
@@ -109,13 +109,13 @@ LL | let c = y;
109
109
| ~
110
110
111
111
error: using a reference to `Cow` is not recommended
112
- --> $DIR/ptr_arg.rs:95 :25
112
+ --> $DIR/ptr_arg.rs:90 :25
113
113
|
114
114
LL | fn test_cow_with_ref(c: &Cow<[i32]>) {}
115
115
| ^^^^^^^^^^^ help: change this to: `&[i32]`
116
116
117
117
error: 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
119
119
|
120
120
LL | fn foo_vec(vec: &Vec<u8>) {
121
121
| ^^^^^^^^
@@ -134,7 +134,7 @@ LL | let _ = vec.to_owned().clone();
134
134
| ~~~~~~~~~~~~~~
135
135
136
136
error: 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
138
138
|
139
139
LL | fn foo_path(path: &PathBuf) {
140
140
| ^^^^^^^^
@@ -153,7 +153,7 @@ LL | let _ = path.to_path_buf().clone();
153
153
| ~~~~~~~~~~~~~~~~~~
154
154
155
155
error: 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
157
157
|
158
158
LL | fn foo_str(str: &PathBuf) {
159
159
| ^^^^^^^^
0 commit comments