]> git.lizzy.rs Git - rust.git/blob - tests/ui/ptr_arg.stderr
Auto merge of #6787 - matthiaskrgr:lint_msgs, r=llogiq
[rust.git] / tests / ui / ptr_arg.stderr
1 error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
2   --> $DIR/ptr_arg.rs:7:14
3    |
4 LL | fn do_vec(x: &Vec<i64>) {
5    |              ^^^^^^^^^ help: change this to: `&[i64]`
6    |
7    = note: `-D clippy::ptr-arg` implied by `-D warnings`
8
9 error: writing `&String` instead of `&str` involves a new object where a slice will do
10   --> $DIR/ptr_arg.rs:16:14
11    |
12 LL | fn do_str(x: &String) {
13    |              ^^^^^^^ help: change this to: `&str`
14
15 error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
16   --> $DIR/ptr_arg.rs:25:15
17    |
18 LL | fn do_path(x: &PathBuf) {
19    |               ^^^^^^^^ help: change this to: `&Path`
20
21 error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
22   --> $DIR/ptr_arg.rs:38:18
23    |
24 LL |     fn do_vec(x: &Vec<i64>);
25    |                  ^^^^^^^^^ help: change this to: `&[i64]`
26
27 error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
28   --> $DIR/ptr_arg.rs:51:14
29    |
30 LL | fn cloned(x: &Vec<u8>) -> Vec<u8> {
31    |              ^^^^^^^^
32    |
33 help: change this to
34    |
35 LL | fn cloned(x: &[u8]) -> Vec<u8> {
36    |              ^^^^^
37 help: change `x.clone()` to
38    |
39 LL |     let e = x.to_owned();
40    |             ^^^^^^^^^^^^
41 help: change `x.clone()` to
42    |
43 LL |     x.to_owned()
44    |
45
46 error: writing `&String` instead of `&str` involves a new object where a slice will do
47   --> $DIR/ptr_arg.rs:60:18
48    |
49 LL | fn str_cloned(x: &String) -> String {
50    |                  ^^^^^^^
51    |
52 help: change this to
53    |
54 LL | fn str_cloned(x: &str) -> String {
55    |                  ^^^^
56 help: change `x.clone()` to
57    |
58 LL |     let a = x.to_string();
59    |             ^^^^^^^^^^^^^
60 help: change `x.clone()` to
61    |
62 LL |     let b = x.to_string();
63    |             ^^^^^^^^^^^^^
64 help: change `x.clone()` to
65    |
66 LL |     x.to_string()
67    |
68
69 error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
70   --> $DIR/ptr_arg.rs:68:19
71    |
72 LL | fn path_cloned(x: &PathBuf) -> PathBuf {
73    |                   ^^^^^^^^
74    |
75 help: change this to
76    |
77 LL | fn path_cloned(x: &Path) -> PathBuf {
78    |                   ^^^^^
79 help: change `x.clone()` to
80    |
81 LL |     let a = x.to_path_buf();
82    |             ^^^^^^^^^^^^^^^
83 help: change `x.clone()` to
84    |
85 LL |     let b = x.to_path_buf();
86    |             ^^^^^^^^^^^^^^^
87 help: change `x.clone()` to
88    |
89 LL |     x.to_path_buf()
90    |
91
92 error: writing `&String` instead of `&str` involves a new object where a slice will do
93   --> $DIR/ptr_arg.rs:76:44
94    |
95 LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
96    |                                            ^^^^^^^
97    |
98 help: change this to
99    |
100 LL | fn false_positive_capacity(x: &Vec<u8>, y: &str) {
101    |                                            ^^^^
102 help: change `y.clone()` to
103    |
104 LL |     let b = y.to_string();
105    |             ^^^^^^^^^^^^^
106 help: change `y.as_str()` to
107    |
108 LL |     let c = y;
109    |             ^
110
111 error: using a reference to `Cow` is not recommended
112   --> $DIR/ptr_arg.rs:90:25
113    |
114 LL | fn test_cow_with_ref(c: &Cow<[i32]>) {}
115    |                         ^^^^^^^^^^^ help: change this to: `&[i32]`
116
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
175