]> git.lizzy.rs Git - rust.git/blob - tests/ui/ptr_arg.stderr
Merge pull request #2984 from flip1995/single_char_pattern
[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 6 | fn do_vec(x: &Vec<i64>) {
5   |              ^^^^^^^^^ help: change this to: `&[i64]`
6   |
7   = note: `-D 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:14:14
11    |
12 14 | 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:27:18
17    |
18 27 |     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:40:14
23    |
24 40 | fn cloned(x: &Vec<u8>) -> Vec<u8> {
25    |              ^^^^^^^^
26 help: change this to
27    |
28 40 | fn cloned(x: &[u8]) -> Vec<u8> {
29    |              ^^^^^
30 help: change `x.clone()` to
31    |
32 41 |     let e = x.to_owned();
33    |             ^^^^^^^^^^^^
34 help: change `x.clone()` to
35    |
36 46 |     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:49:18
41    |
42 49 | fn str_cloned(x: &String) -> String {
43    |                  ^^^^^^^
44 help: change this to
45    |
46 49 | fn str_cloned(x: &str) -> String {
47    |                  ^^^^
48 help: change `x.clone()` to
49    |
50 50 |     let a = x.to_string();
51    |             ^^^^^^^^^^^^^
52 help: change `x.clone()` to
53    |
54 51 |     let b = x.to_string();
55    |             ^^^^^^^^^^^^^
56 help: change `x.clone()` to
57    |
58 56 |     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:59:44
63    |
64 59 | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
65    |                                            ^^^^^^^
66 help: change this to
67    |
68 59 | fn false_positive_capacity(x: &Vec<u8>, y: &str) {
69    |                                            ^^^^
70 help: change `y.clone()` to
71    |
72 61 |     let b = y.to_string();
73    |             ^^^^^^^^^^^^^
74 help: change `y.as_str()` to
75    |
76 62 |     let c = y;
77    |             ^
78
79 error: using a reference to `Cow` is not recommended.
80   --> $DIR/ptr_arg.rs:71:25
81    |
82 71 | fn test_cow_with_ref(c: &Cow<[i32]>) {
83    |                         ^^^^^^^^^^^ help: change this to: `&[i32]`
84
85 error: aborting due to 7 previous errors
86