]> git.lizzy.rs Git - rust.git/blob - tests/ui/ptr_arg.stderr
Merge branch 'master' into no_effect_with_drop
[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    |
27 help: change this to
28    |
29 40 | fn cloned(x: &[u8]) -> Vec<u8> {
30    |              ^^^^^
31 help: change `x.clone()` to
32    |
33 41 |     let e = x.to_owned();
34    |             ^^^^^^^^^^^^
35 help: change `x.clone()` to
36    |
37 46 |     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:49:18
42    |
43 49 | fn str_cloned(x: &String) -> String {
44    |                  ^^^^^^^
45    |
46 help: change this to
47    |
48 49 | fn str_cloned(x: &str) -> String {
49    |                  ^^^^
50 help: change `x.clone()` to
51    |
52 50 |     let a = x.to_string();
53    |             ^^^^^^^^^^^^^
54 help: change `x.clone()` to
55    |
56 51 |     let b = x.to_string();
57    |             ^^^^^^^^^^^^^
58 help: change `x.clone()` to
59    |
60 56 |     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:59:44
65    |
66 59 | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
67    |                                            ^^^^^^^
68    |
69 help: change this to
70    |
71 59 | fn false_positive_capacity(x: &Vec<u8>, y: &str) {
72    |                                            ^^^^
73 help: change `y.clone()` to
74    |
75 61 |     let b = y.to_string();
76    |             ^^^^^^^^^^^^^
77 help: change `y.as_str()` to
78    |
79 62 |     let c = y;
80    |             ^
81