]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/ptr_arg.stderr
bump version to 1.80.1+dfsg1-1~bpo12+pve1
[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
c620b35d 2 --> tests/ui/ptr_arg.rs:14:14
f20569fa
XL
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`
781aab86 8 = help: to override `-D warnings` add `#[allow(clippy::ptr_arg)]`
f20569fa 9
5099ac24 10error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
c620b35d 11 --> tests/ui/ptr_arg.rs:20:18
5099ac24
FG
12 |
13LL | fn do_vec_mut(x: &mut Vec<i64>) {
14 | ^^^^^^^^^^^^^ help: change this to: `&mut [i64]`
15
4b012472 16error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
c620b35d 17 --> tests/ui/ptr_arg.rs:25:19
4b012472
FG
18 |
19LL | fn do_vec_mut2(x: &mut Vec<i64>) {
20 | ^^^^^^^^^^^^^ help: change this to: `&mut [i64]`
21
f20569fa 22error: writing `&String` instead of `&str` involves a new object where a slice will do
c620b35d 23 --> tests/ui/ptr_arg.rs:31:14
f20569fa
XL
24 |
25LL | fn do_str(x: &String) {
26 | ^^^^^^^ help: change this to: `&str`
27
5099ac24 28error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do
c620b35d 29 --> tests/ui/ptr_arg.rs:36:18
5099ac24
FG
30 |
31LL | fn do_str_mut(x: &mut String) {
32 | ^^^^^^^^^^^ help: change this to: `&mut str`
33
f20569fa 34error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
c620b35d 35 --> tests/ui/ptr_arg.rs:41:15
f20569fa
XL
36 |
37LL | fn do_path(x: &PathBuf) {
38 | ^^^^^^^^ help: change this to: `&Path`
39
5099ac24 40error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do
c620b35d 41 --> tests/ui/ptr_arg.rs:46:19
5099ac24
FG
42 |
43LL | fn do_path_mut(x: &mut PathBuf) {
44 | ^^^^^^^^^^^^ help: change this to: `&mut Path`
45
46error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
c620b35d 47 --> tests/ui/ptr_arg.rs:55:18
f20569fa
XL
48 |
49LL | fn do_vec(x: &Vec<i64>);
50 | ^^^^^^^^^ help: change this to: `&[i64]`
51
5099ac24 52error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
c620b35d 53 --> tests/ui/ptr_arg.rs:69:14
f20569fa
XL
54 |
55LL | fn cloned(x: &Vec<u8>) -> Vec<u8> {
56 | ^^^^^^^^
57 |
58help: change this to
59 |
5099ac24 60LL ~ fn cloned(x: &[u8]) -> Vec<u8> {
781aab86 61LL |
5099ac24
FG
62LL ~ let e = x.to_owned();
63LL | let f = e.clone(); // OK
64LL | let g = x;
65LL ~ let h = g.to_owned();
66LL | let i = (e).clone();
923072b8
FG
67LL ~ x.to_owned()
68 |
f20569fa
XL
69
70error: writing `&String` instead of `&str` involves a new object where a slice will do
c620b35d 71 --> tests/ui/ptr_arg.rs:79:18
f20569fa
XL
72 |
73LL | fn str_cloned(x: &String) -> String {
74 | ^^^^^^^
75 |
76help: change this to
77 |
5099ac24 78LL ~ fn str_cloned(x: &str) -> String {
781aab86 79LL |
5099ac24
FG
80LL ~ let a = x.to_owned();
81LL ~ let b = x.to_owned();
82LL | let c = b.clone();
83LL | let d = a.clone().clone().clone();
84LL ~ x.to_owned()
f20569fa
XL
85 |
86
87error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
c620b35d 88 --> tests/ui/ptr_arg.rs:88:19
f20569fa
XL
89 |
90LL | fn path_cloned(x: &PathBuf) -> PathBuf {
91 | ^^^^^^^^
92 |
93help: change this to
94 |
5099ac24 95LL ~ fn path_cloned(x: &Path) -> PathBuf {
781aab86 96LL |
5099ac24
FG
97LL ~ let a = x.to_path_buf();
98LL ~ let b = x.to_path_buf();
99LL | let c = b.clone();
100LL | let d = a.clone().clone().clone();
101LL ~ x.to_path_buf()
f20569fa
XL
102 |
103
104error: writing `&String` instead of `&str` involves a new object where a slice will do
c620b35d 105 --> tests/ui/ptr_arg.rs:97:44
f20569fa
XL
106 |
107LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
108 | ^^^^^^^
109 |
110help: change this to
111 |
5099ac24 112LL ~ fn false_positive_capacity(x: &Vec<u8>, y: &str) {
781aab86 113LL |
5099ac24
FG
114LL | let a = x.capacity();
115LL ~ let b = y.to_owned();
116LL ~ let c = y;
f20569fa 117 |
f20569fa
XL
118
119error: using a reference to `Cow` is not recommended
c620b35d 120 --> tests/ui/ptr_arg.rs:112:25
f20569fa
XL
121 |
122LL | fn test_cow_with_ref(c: &Cow<[i32]>) {}
123 | ^^^^^^^^^^^ help: change this to: `&[i32]`
124
064997fb 125error: writing `&String` instead of `&str` involves a new object where a slice will do
c620b35d 126 --> tests/ui/ptr_arg.rs:142:66
064997fb
FG
127 |
128LL | fn some_allowed(#[allow(clippy::ptr_arg)] _v: &Vec<u32>, _s: &String) {}
129 | ^^^^^^^ help: change this to: `&str`
130
5099ac24 131error: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
c620b35d 132 --> tests/ui/ptr_arg.rs:172:21
f20569fa
XL
133 |
134LL | fn foo_vec(vec: &Vec<u8>) {
135 | ^^^^^^^^
136 |
137help: change this to
138 |
5099ac24 139LL ~ fn foo_vec(vec: &[u8]) {
781aab86 140LL |
5099ac24
FG
141LL ~ let _ = vec.to_owned().pop();
142LL ~ let _ = vec.to_owned().clone();
f20569fa 143 |
f20569fa
XL
144
145error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
c620b35d 146 --> tests/ui/ptr_arg.rs:178:23
f20569fa
XL
147 |
148LL | fn foo_path(path: &PathBuf) {
149 | ^^^^^^^^
150 |
151help: change this to
152 |
5099ac24 153LL ~ fn foo_path(path: &Path) {
781aab86 154LL |
5099ac24
FG
155LL ~ let _ = path.to_path_buf().pop();
156LL ~ let _ = path.to_path_buf().clone();
f20569fa 157 |
f20569fa
XL
158
159error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
c620b35d 160 --> tests/ui/ptr_arg.rs:184:21
f20569fa
XL
161 |
162LL | fn foo_str(str: &PathBuf) {
163 | ^^^^^^^^
164 |
165help: change this to
166 |
5099ac24 167LL ~ fn foo_str(str: &Path) {
781aab86 168LL |
5099ac24
FG
169LL ~ let _ = str.to_path_buf().pop();
170LL ~ let _ = str.to_path_buf().clone();
f20569fa 171 |
5099ac24
FG
172
173error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
c620b35d 174 --> tests/ui/ptr_arg.rs:191:29
f20569fa 175 |
5099ac24
FG
176LL | fn mut_vec_slice_methods(v: &mut Vec<u32>) {
177 | ^^^^^^^^^^^^^ help: change this to: `&mut [u32]`
f20569fa 178
2b03887a 179error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
c620b35d 180 --> tests/ui/ptr_arg.rs:254:17
2b03887a
FG
181 |
182LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
183 | ^^^^^^^^^^^^^ help: change this to: `&mut [u32]`
184
185error: writing `&mut String` instead of `&mut str` involves a new object where a slice will do
c620b35d 186 --> tests/ui/ptr_arg.rs:254:35
2b03887a
FG
187 |
188LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
189 | ^^^^^^^^^^^ help: change this to: `&mut str`
190
191error: writing `&mut PathBuf` instead of `&mut Path` involves a new object where a slice will do
c620b35d 192 --> tests/ui/ptr_arg.rs:254:51
2b03887a
FG
193 |
194LL | fn dyn_trait(a: &mut Vec<u32>, b: &mut String, c: &mut PathBuf) {
195 | ^^^^^^^^^^^^ help: change this to: `&mut Path`
196
fe692bf9 197error: using a reference to `Cow` is not recommended
c620b35d 198 --> tests/ui/ptr_arg.rs:280:39
fe692bf9
FG
199 |
200LL | fn cow_elided_lifetime<'a>(input: &'a Cow<str>) -> &'a str {
201 | ^^^^^^^^^^^^ help: change this to: `&str`
202
203error: using a reference to `Cow` is not recommended
c620b35d 204 --> tests/ui/ptr_arg.rs:286:36
fe692bf9
FG
205 |
206LL | fn cow_bad_ret_ty_1<'a>(input: &'a Cow<'a, str>) -> &'static str {
207 | ^^^^^^^^^^^^^^^^ help: change this to: `&str`
208
209error: using a reference to `Cow` is not recommended
c620b35d 210 --> tests/ui/ptr_arg.rs:290:40
fe692bf9
FG
211 |
212LL | fn cow_bad_ret_ty_2<'a, 'b>(input: &'a Cow<'a, str>) -> &'b str {
213 | ^^^^^^^^^^^^^^^^ help: change this to: `&str`
214
4b012472 215error: aborting due to 24 previous errors
f20569fa 216