]> git.lizzy.rs Git - rust.git/blob - tests/ui/ptr_arg.stderr
iterate List by value
[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:6: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:15:14
11    |
12 LL | fn do_str(x: &String) {
13    |              ^^^^^^^ help: change this to: `&str`
14
15 error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices.
16   --> $DIR/ptr_arg.rs:28:18
17    |
18 LL |     fn do_vec(x: &Vec<i64>);
19    |                  ^^^^^^^^^ help: change this to: `&[i64]`
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:41:14
23    |
24 LL | fn cloned(x: &Vec<u8>) -> Vec<u8> {
25    |              ^^^^^^^^
26    |
27 help: change this to
28    |
29 LL | fn cloned(x: &[u8]) -> Vec<u8> {
30    |              ^^^^^
31 help: change `x.clone()` to
32    |
33 LL |     let e = x.to_owned();
34    |             ^^^^^^^^^^^^
35 help: change `x.clone()` to
36    |
37 LL |     x.to_owned()
38    |
39
40 error: writing `&String` instead of `&str` involves a new object where a slice will do.
41   --> $DIR/ptr_arg.rs:50:18
42    |
43 LL | fn str_cloned(x: &String) -> String {
44    |                  ^^^^^^^
45    |
46 help: change this to
47    |
48 LL | fn str_cloned(x: &str) -> String {
49    |                  ^^^^
50 help: change `x.clone()` to
51    |
52 LL |     let a = x.to_string();
53    |             ^^^^^^^^^^^^^
54 help: change `x.clone()` to
55    |
56 LL |     let b = x.to_string();
57    |             ^^^^^^^^^^^^^
58 help: change `x.clone()` to
59    |
60 LL |     x.to_string()
61    |
62
63 error: writing `&String` instead of `&str` involves a new object where a slice will do.
64   --> $DIR/ptr_arg.rs:58:44
65    |
66 LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
67    |                                            ^^^^^^^
68    |
69 help: change this to
70    |
71 LL | fn false_positive_capacity(x: &Vec<u8>, y: &str) {
72    |                                            ^^^^
73 help: change `y.clone()` to
74    |
75 LL |     let b = y.to_string();
76    |             ^^^^^^^^^^^^^
77 help: change `y.as_str()` to
78    |
79 LL |     let c = y;
80    |             ^
81
82 error: using a reference to `Cow` is not recommended.
83   --> $DIR/ptr_arg.rs:72:25
84    |
85 LL | fn test_cow_with_ref(c: &Cow<[i32]>) {}
86    |                         ^^^^^^^^^^^ help: change this to: `&[i32]`
87
88 error: aborting due to 7 previous errors
89