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