1 error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
2 --> $DIR/ptr_arg.rs:7:14
4 LL | fn do_vec(x: &Vec<i64>) {
5 | ^^^^^^^^^ help: change this to: `&[i64]`
7 = note: `-D clippy::ptr-arg` implied by `-D warnings`
9 error: writing `&String` instead of `&str` involves a new object where a slice will do
10 --> $DIR/ptr_arg.rs:16:14
12 LL | fn do_str(x: &String) {
13 | ^^^^^^^ help: change this to: `&str`
15 error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
16 --> $DIR/ptr_arg.rs:25:15
18 LL | fn do_path(x: &PathBuf) {
19 | ^^^^^^^^ help: change this to: `&Path`
21 error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
22 --> $DIR/ptr_arg.rs:38:18
24 LL | fn do_vec(x: &Vec<i64>);
25 | ^^^^^^^^^ help: change this to: `&[i64]`
27 error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
28 --> $DIR/ptr_arg.rs:51:14
30 LL | fn cloned(x: &Vec<u8>) -> Vec<u8> {
35 LL | fn cloned(x: &[u8]) -> Vec<u8> {
37 help: change `x.clone()` to
39 LL | let e = x.to_owned();
41 help: change `x.clone()` to
46 error: writing `&String` instead of `&str` involves a new object where a slice will do
47 --> $DIR/ptr_arg.rs:60:18
49 LL | fn str_cloned(x: &String) -> String {
54 LL | fn str_cloned(x: &str) -> String {
56 help: change `x.clone()` to
58 LL | let a = x.to_string();
60 help: change `x.clone()` to
62 LL | let b = x.to_string();
64 help: change `x.clone()` to
69 error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
70 --> $DIR/ptr_arg.rs:68:19
72 LL | fn path_cloned(x: &PathBuf) -> PathBuf {
77 LL | fn path_cloned(x: &Path) -> PathBuf {
79 help: change `x.clone()` to
81 LL | let a = x.to_path_buf();
83 help: change `x.clone()` to
85 LL | let b = x.to_path_buf();
87 help: change `x.clone()` to
92 error: writing `&String` instead of `&str` involves a new object where a slice will do
93 --> $DIR/ptr_arg.rs:76:44
95 LL | fn false_positive_capacity(x: &Vec<u8>, y: &String) {
100 LL | fn false_positive_capacity(x: &Vec<u8>, y: &str) {
102 help: change `y.clone()` to
104 LL | let b = y.to_string();
106 help: change `y.as_str()` to
111 error: using a reference to `Cow` is not recommended
112 --> $DIR/ptr_arg.rs:90:25
114 LL | fn test_cow_with_ref(c: &Cow<[i32]>) {}
115 | ^^^^^^^^^^^ help: change this to: `&[i32]`
117 error: writing `&Vec<_>` instead of `&[_]` involves one more reference and cannot be used with non-Vec-based slices
118 --> $DIR/ptr_arg.rs:143:21
120 LL | fn foo_vec(vec: &Vec<u8>) {
125 LL | fn foo_vec(vec: &[u8]) {
127 help: change `vec.clone()` to
129 LL | let _ = vec.to_owned().pop();
131 help: change `vec.clone()` to
133 LL | let _ = vec.to_owned().clone();
136 error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
137 --> $DIR/ptr_arg.rs:148:23
139 LL | fn foo_path(path: &PathBuf) {
144 LL | fn foo_path(path: &Path) {
146 help: change `path.clone()` to
148 LL | let _ = path.to_path_buf().pop();
150 help: change `path.clone()` to
152 LL | let _ = path.to_path_buf().clone();
155 error: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
156 --> $DIR/ptr_arg.rs:153:21
158 LL | fn foo_str(str: &PathBuf) {
163 LL | fn foo_str(str: &Path) {
165 help: change `str.clone()` to
167 LL | let _ = str.to_path_buf().pop();
169 help: change `str.clone()` to
171 LL | let _ = str.to_path_buf().clone();
174 error: aborting due to 12 previous errors