]> git.lizzy.rs Git - rust.git/blob - tests/ui/ptr_arg.stderr
Auto merge of #8359 - flip1995:rustup, r=flip1995
[rust.git] / tests / ui / ptr_arg.stderr
1 error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
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 `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
10   --> $DIR/ptr_arg.rs:11:18
11    |
12 LL | fn do_vec_mut(x: &mut Vec<i64>) {
13    |                  ^^^^^^^^^^^^^ help: change this to: `&mut [i64]`
14
15 error: writing `&String` instead of `&str` involves a new object where a slice will do
16   --> $DIR/ptr_arg.rs:15:14
17    |
18 LL | fn do_str(x: &String) {
19    |              ^^^^^^^ help: change this to: `&str`
20
21 error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do
22   --> $DIR/ptr_arg.rs:19:18
23    |
24 LL | fn do_str_mut(x: &mut String) {
25    |                  ^^^^^^^^^^^ help: change this to: `&mut str`
26
27 error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
28   --> $DIR/ptr_arg.rs:23:15
29    |
30 LL | fn do_path(x: &PathBuf) {
31    |               ^^^^^^^^ help: change this to: `&Path`
32
33 error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do
34   --> $DIR/ptr_arg.rs:27:19
35    |
36 LL | fn do_path_mut(x: &mut PathBuf) {
37    |                   ^^^^^^^^^^^^ help: change this to: `&mut Path`
38
39 error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
40   --> $DIR/ptr_arg.rs:35:18
41    |
42 LL |     fn do_vec(x: &Vec<i64>);
43    |                  ^^^^^^^^^ help: change this to: `&[i64]`
44
45 error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
46   --> $DIR/ptr_arg.rs:48:14
47    |
48 LL | fn cloned(x: &Vec<u8>) -> Vec<u8> {
49    |              ^^^^^^^^
50    |
51 help: change this to
52    |
53 LL ~ fn cloned(x: &[u8]) -> Vec<u8> {
54 LL ~     let e = x.to_owned();
55 LL |     let f = e.clone(); // OK
56 LL |     let g = x;
57 LL ~     let h = g.to_owned();
58 LL |     let i = (e).clone();
59  ...
60
61 error: writing `&String` instead of `&str` involves a new object where a slice will do
62   --> $DIR/ptr_arg.rs:57:18
63    |
64 LL | fn str_cloned(x: &String) -> String {
65    |                  ^^^^^^^
66    |
67 help: change this to
68    |
69 LL ~ fn str_cloned(x: &str) -> String {
70 LL ~     let a = x.to_owned();
71 LL ~     let b = x.to_owned();
72 LL |     let c = b.clone();
73 LL |     let d = a.clone().clone().clone();
74 LL ~     x.to_owned()
75    |
76
77 error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
78   --> $DIR/ptr_arg.rs:65:19
79    |
80 LL | fn path_cloned(x: &PathBuf) -> PathBuf {
81    |                   ^^^^^^^^
82    |
83 help: change this to
84    |
85 LL ~ fn path_cloned(x: &Path) -> PathBuf {
86 LL ~     let a = x.to_path_buf();
87 LL ~     let b = x.to_path_buf();
88 LL |     let c = b.clone();
89 LL |     let d = a.clone().clone().clone();
90 LL ~     x.to_path_buf()
91    |
92
93 error: writing `&String` instead of `&str` involves a new object where a slice will do
94   --> $DIR/ptr_arg.rs:73:44
95    |
96 LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
97    |                                            ^^^^^^^
98    |
99 help: change this to
100    |
101 LL ~ fn false_positive_capacity(x: &Vec<u8>, y: &str) {
102 LL |     let a = x.capacity();
103 LL ~     let b = y.to_owned();
104 LL ~     let c = y;
105    |
106
107 error: using a reference to `Cow` is not recommended
108   --> $DIR/ptr_arg.rs:87:25
109    |
110 LL | fn test_cow_with_ref(c: &Cow<[i32]>) {}
111    |                         ^^^^^^^^^^^ help: change this to: `&[i32]`
112
113 error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
114   --> $DIR/ptr_arg.rs:140:21
115    |
116 LL |     fn foo_vec(vec: &Vec<u8>) {
117    |                     ^^^^^^^^
118    |
119 help: change this to
120    |
121 LL ~     fn foo_vec(vec: &[u8]) {
122 LL ~         let _ = vec.to_owned().pop();
123 LL ~         let _ = vec.to_owned().clone();
124    |
125
126 error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
127   --> $DIR/ptr_arg.rs:145:23
128    |
129 LL |     fn foo_path(path: &PathBuf) {
130    |                       ^^^^^^^^
131    |
132 help: change this to
133    |
134 LL ~     fn foo_path(path: &Path) {
135 LL ~         let _ = path.to_path_buf().pop();
136 LL ~         let _ = path.to_path_buf().clone();
137    |
138
139 error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
140   --> $DIR/ptr_arg.rs:150:21
141    |
142 LL |     fn foo_str(str: &PathBuf) {
143    |                     ^^^^^^^^
144    |
145 help: change this to
146    |
147 LL ~     fn foo_str(str: &Path) {
148 LL ~         let _ = str.to_path_buf().pop();
149 LL ~         let _ = str.to_path_buf().clone();
150    |
151
152 error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
153   --> $DIR/ptr_arg.rs:156:29
154    |
155 LL | fn mut_vec_slice_methods(v: &mut Vec<u32>) {
156    |                             ^^^^^^^^^^^^^ help: change this to: `&mut [u32]`
157
158 error: aborting due to 16 previous errors
159