]> git.lizzy.rs Git - rust.git/blob - tests/ui/ptr_arg.stderr
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[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:15: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:24: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:37: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:50:14
23    |
24 LL | fn cloned(x: &Vec<u8>) -> Vec<u8> {
25    |              ^^^^^^^^
26 help: change this to
27    |
28 LL | fn cloned(x: &[u8]) -> Vec<u8> {
29    |              ^^^^^
30 help: change `x.clone()` to
31    |
32 LL |     let e = x.to_owned();
33    |             ^^^^^^^^^^^^
34 help: change `x.clone()` to
35    |
36 LL |     x.to_owned()
37    |
38
39 error: writing `&String` instead of `&str` involves a new object where a slice will do.
40   --> $DIR/ptr_arg.rs:59:18
41    |
42 LL | fn str_cloned(x: &String) -> String {
43    |                  ^^^^^^^
44 help: change this to
45    |
46 LL | fn str_cloned(x: &str) -> String {
47    |                  ^^^^
48 help: change `x.clone()` to
49    |
50 LL |     let a = x.to_string();
51    |             ^^^^^^^^^^^^^
52 help: change `x.clone()` to
53    |
54 LL |     let b = x.to_string();
55    |             ^^^^^^^^^^^^^
56 help: change `x.clone()` to
57    |
58 LL |     x.to_string()
59    |
60
61 error: writing `&String` instead of `&str` involves a new object where a slice will do.
62   --> $DIR/ptr_arg.rs:67:44
63    |
64 LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
65    |                                            ^^^^^^^
66 help: change this to
67    |
68 LL | fn false_positive_capacity(x: &Vec<u8>, y: &str) {
69    |                                            ^^^^
70 help: change `y.clone()` to
71    |
72 LL |     let b = y.to_string();
73    |             ^^^^^^^^^^^^^
74 help: change `y.as_str()` to
75    |
76 LL |     let c = y;
77    |             ^
78
79 error: using a reference to `Cow` is not recommended.
80   --> $DIR/ptr_arg.rs:81:25
81    |
82 LL | fn test_cow_with_ref(c: &Cow<[i32]>) {}
83    |                         ^^^^^^^^^^^ help: change this to: `&[i32]`
84
85 error: aborting due to 7 previous errors
86