Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f06c1b8

Browse files
committedJul 6, 2023
Auto merge of #113417 - flip1995:clippy_beta_backport, r=Manishearth
[beta] Clippy beta backport Backported PRs: - rust-lang/rust-clippy#10813 - rust-lang/rust-clippy#10865 - rust-lang/rust-clippy#10873 - rust-lang/rust-clippy#10992 Those address bugs, that were either introduced with 1.71 and that we would like to address before they get into stable or bugs that were introduced in 1.70 and that we would like to be fixed in 1.71 already. Detailed arguments for the backports of those PRs are in the PRs (mostly). r? `@Mark-Simulacrum`
2 parents dbf31f1 + 8cde275 commit f06c1b8

15 files changed

+164
-51
lines changed
 

‎src/tools/clippy/clippy_lints/src/default_constructed_unit_structs.rs‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use clippy_utils::{diagnostics::span_lint_and_sugg, match_def_path, paths};
1+
use clippy_utils::{diagnostics::span_lint_and_sugg, is_ty_alias, match_def_path, paths};
22
use hir::{def::Res, ExprKind};
33
use rustc_errors::Applicability;
44
use rustc_hir as hir;
@@ -43,12 +43,23 @@ declare_clippy_lint! {
4343
}
4444
declare_lint_pass!(DefaultConstructedUnitStructs => [DEFAULT_CONSTRUCTED_UNIT_STRUCTS]);
4545

46+
fn is_alias(ty: hir::Ty<'_>) -> bool {
47+
if let hir::TyKind::Path(ref qpath) = ty.kind {
48+
is_ty_alias(qpath)
49+
} else {
50+
false
51+
}
52+
}
53+
4654
impl LateLintPass<'_> for DefaultConstructedUnitStructs {
4755
fn check_expr<'tcx>(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {
4856
if_chain!(
4957
// make sure we have a call to `Default::default`
5058
if let hir::ExprKind::Call(fn_expr, &[]) = expr.kind;
51-
if let ExprKind::Path(ref qpath@ hir::QPath::TypeRelative(_,_)) = fn_expr.kind;
59+
if let ExprKind::Path(ref qpath @ hir::QPath::TypeRelative(base, _)) = fn_expr.kind;
60+
// make sure this isn't a type alias:
61+
// `<Foo as Bar>::Assoc` cannot be used as a constructor
62+
if !is_alias(*base);
5263
if let Res::Def(_, def_id) = cx.qpath_res(qpath, fn_expr.hir_id);
5364
if match_def_path(cx, def_id, &paths::DEFAULT_TRAIT_METHOD);
5465
// make sure we have a struct with no fields (unit struct)

‎src/tools/clippy/clippy_lints/src/items_after_test_module.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use clippy_utils::{diagnostics::span_lint_and_help, is_in_cfg_test};
1+
use clippy_utils::{diagnostics::span_lint_and_help, is_from_proc_macro, is_in_cfg_test};
22
use rustc_hir::{HirId, ItemId, ItemKind, Mod};
33
use rustc_lint::{LateContext, LateLintPass, LintContext};
44
use rustc_middle::lint::in_external_macro;
@@ -59,6 +59,7 @@ impl LateLintPass<'_> for ItemsAfterTestModule {
5959
if !matches!(item.kind, ItemKind::Mod(_));
6060
if !is_in_cfg_test(cx.tcx, itid.hir_id()); // The item isn't in the testing module itself
6161
if !in_external_macro(cx.sess(), item.span);
62+
if !is_from_proc_macro(cx, item);
6263

6364
then {
6465
span_lint_and_help(cx, ITEMS_AFTER_TEST_MODULE, test_mod_span.unwrap().with_hi(item.span.hi()), "items were found after the testing module", None, "move the items to before the testing module was defined");

‎src/tools/clippy/clippy_lints/src/let_with_type_underscore.rs‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use clippy_utils::diagnostics::span_lint_and_help;
2+
use clippy_utils::source::snippet;
23
use rustc_hir::{Local, TyKind};
34
use rustc_lint::{LateContext, LateLintPass};
45
use rustc_middle::lint::in_external_macro;
@@ -25,14 +26,21 @@ declare_clippy_lint! {
2526
declare_lint_pass!(UnderscoreTyped => [LET_WITH_TYPE_UNDERSCORE]);
2627

2728
impl LateLintPass<'_> for UnderscoreTyped {
28-
fn check_local<'tcx>(&mut self, cx: &LateContext<'tcx>, local: &'tcx Local<'tcx>) {
29+
fn check_local(&mut self, cx: &LateContext<'_>, local: &Local<'_>) {
2930
if_chain! {
3031
if !in_external_macro(cx.tcx.sess, local.span);
3132
if let Some(ty) = local.ty; // Ensure that it has a type defined
3233
if let TyKind::Infer = &ty.kind; // that type is '_'
3334
if local.span.ctxt() == ty.span.ctxt();
3435
then {
35-
span_lint_and_help(cx,
36+
// NOTE: Using `is_from_proc_macro` on `init` will require that it's initialized,
37+
// this doesn't. Alternatively, `WithSearchPat` can be implemented for `Ty`
38+
if snippet(cx, ty.span, "_").trim() != "_" {
39+
return;
40+
}
41+
42+
span_lint_and_help(
43+
cx,
3644
LET_WITH_TYPE_UNDERSCORE,
3745
local.span,
3846
"variable declared with type underscore",

‎src/tools/clippy/clippy_lints/src/redundant_clone.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ declare_clippy_lint! {
5757
/// ```
5858
#[clippy::version = "1.32.0"]
5959
pub REDUNDANT_CLONE,
60-
perf,
60+
nursery,
6161
"`clone()` of an owned value that is going to be dropped immediately"
6262
}
6363

‎src/tools/clippy/clippy_utils/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ pub fn is_wild(pat: &Pat<'_>) -> bool {
287287
/// Checks if the given `QPath` belongs to a type alias.
288288
pub fn is_ty_alias(qpath: &QPath<'_>) -> bool {
289289
match *qpath {
290-
QPath::Resolved(_, path) => matches!(path.res, Res::Def(DefKind::TyAlias, ..)),
290+
QPath::Resolved(_, path) => matches!(path.res, Res::Def(DefKind::TyAlias | DefKind::AssocTy, ..)),
291291
QPath::TypeRelative(ty, _) if let TyKind::Path(qpath) = ty.kind => { is_ty_alias(&qpath) },
292292
_ => false,
293293
}

‎src/tools/clippy/tests/ui/default_constructed_unit_structs.fixed‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,28 @@ struct EmptyStruct {}
101101
#[non_exhaustive]
102102
struct NonExhaustiveStruct;
103103

104+
mod issue_10755 {
105+
struct Sqlite {}
106+
107+
trait HasArguments<'q> {
108+
type Arguments;
109+
}
110+
111+
impl<'q> HasArguments<'q> for Sqlite {
112+
type Arguments = std::marker::PhantomData<&'q ()>;
113+
}
114+
115+
type SqliteArguments<'q> = <Sqlite as HasArguments<'q>>::Arguments;
116+
117+
fn foo() {
118+
// should not lint
119+
// type alias cannot be used as a constructor
120+
let _ = <Sqlite as HasArguments>::Arguments::default();
121+
122+
let _ = SqliteArguments::default();
123+
}
124+
}
125+
104126
fn main() {
105127
// should lint
106128
let _ = PhantomData::<usize>;

‎src/tools/clippy/tests/ui/default_constructed_unit_structs.rs‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,28 @@ struct EmptyStruct {}
101101
#[non_exhaustive]
102102
struct NonExhaustiveStruct;
103103

104+
mod issue_10755 {
105+
struct Sqlite {}
106+
107+
trait HasArguments<'q> {
108+
type Arguments;
109+
}
110+
111+
impl<'q> HasArguments<'q> for Sqlite {
112+
type Arguments = std::marker::PhantomData<&'q ()>;
113+
}
114+
115+
type SqliteArguments<'q> = <Sqlite as HasArguments<'q>>::Arguments;
116+
117+
fn foo() {
118+
// should not lint
119+
// type alias cannot be used as a constructor
120+
let _ = <Sqlite as HasArguments>::Arguments::default();
121+
122+
let _ = SqliteArguments::default();
123+
}
124+
}
125+
104126
fn main() {
105127
// should lint
106128
let _ = PhantomData::<usize>::default();

‎src/tools/clippy/tests/ui/default_constructed_unit_structs.stderr‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,25 @@ LL | inner: PhantomData::default(),
1313
| ^^^^^^^^^^^ help: remove this call to `default`
1414

1515
error: use of `default` to create a unit struct
16-
--> $DIR/default_constructed_unit_structs.rs:106:33
16+
--> $DIR/default_constructed_unit_structs.rs:128:33
1717
|
1818
LL | let _ = PhantomData::<usize>::default();
1919
| ^^^^^^^^^^^ help: remove this call to `default`
2020

2121
error: use of `default` to create a unit struct
22-
--> $DIR/default_constructed_unit_structs.rs:107:42
22+
--> $DIR/default_constructed_unit_structs.rs:129:42
2323
|
2424
LL | let _: PhantomData<i32> = PhantomData::default();
2525
| ^^^^^^^^^^^ help: remove this call to `default`
2626

2727
error: use of `default` to create a unit struct
28-
--> $DIR/default_constructed_unit_structs.rs:108:55
28+
--> $DIR/default_constructed_unit_structs.rs:130:55
2929
|
3030
LL | let _: PhantomData<i32> = std::marker::PhantomData::default();
3131
| ^^^^^^^^^^^ help: remove this call to `default`
3232

3333
error: use of `default` to create a unit struct
34-
--> $DIR/default_constructed_unit_structs.rs:109:23
34+
--> $DIR/default_constructed_unit_structs.rs:131:23
3535
|
3636
LL | let _ = UnitStruct::default();
3737
| ^^^^^^^^^^^ help: remove this call to `default`
Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,42 @@
1+
//@aux-build: proc_macros.rs
12
#![allow(unused)]
23
#![warn(clippy::let_with_type_underscore)]
3-
#![allow(clippy::let_unit_value)]
4+
#![allow(clippy::let_unit_value, clippy::needless_late_init)]
5+
6+
extern crate proc_macros;
47

58
fn func() -> &'static str {
69
""
710
}
811

12+
#[rustfmt::skip]
913
fn main() {
1014
// Will lint
1115
let x: _ = 1;
1216
let _: _ = 2;
1317
let x: _ = func();
18+
let x: _;
19+
x = ();
1420

1521
let x = 1; // Will not lint, Rust infers this to an integer before Clippy
1622
let x = func();
1723
let x: Vec<_> = Vec::<u32>::new();
1824
let x: [_; 1] = [1];
25+
let x : _ = 1;
26+
27+
// Do not lint from procedural macros
28+
proc_macros::with_span! {
29+
span
30+
let x: _ = ();
31+
// Late initialization
32+
let x: _;
33+
x = ();
34+
// Ensure weird formatting will not break it (hopefully)
35+
let x : _ = 1;
36+
let x
37+
: _ = 1;
38+
let x :
39+
_;
40+
x = ();
41+
};
1942
}
Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,63 @@
11
error: variable declared with type underscore
2-
--> $DIR/let_with_type_underscore.rs:11:5
2+
--> $DIR/let_with_type_underscore.rs:15:5
33
|
44
LL | let x: _ = 1;
55
| ^^^^^^^^^^^^^
66
|
77
help: remove the explicit type `_` declaration
8-
--> $DIR/let_with_type_underscore.rs:11:10
8+
--> $DIR/let_with_type_underscore.rs:15:10
99
|
1010
LL | let x: _ = 1;
1111
| ^^^
1212
= note: `-D clippy::let-with-type-underscore` implied by `-D warnings`
1313

1414
error: variable declared with type underscore
15-
--> $DIR/let_with_type_underscore.rs:12:5
15+
--> $DIR/let_with_type_underscore.rs:16:5
1616
|
1717
LL | let _: _ = 2;
1818
| ^^^^^^^^^^^^^
1919
|
2020
help: remove the explicit type `_` declaration
21-
--> $DIR/let_with_type_underscore.rs:12:10
21+
--> $DIR/let_with_type_underscore.rs:16:10
2222
|
2323
LL | let _: _ = 2;
2424
| ^^^
2525

2626
error: variable declared with type underscore
27-
--> $DIR/let_with_type_underscore.rs:13:5
27+
--> $DIR/let_with_type_underscore.rs:17:5
2828
|
2929
LL | let x: _ = func();
3030
| ^^^^^^^^^^^^^^^^^^
3131
|
3232
help: remove the explicit type `_` declaration
33-
--> $DIR/let_with_type_underscore.rs:13:10
33+
--> $DIR/let_with_type_underscore.rs:17:10
3434
|
3535
LL | let x: _ = func();
3636
| ^^^
3737

38-
error: aborting due to 3 previous errors
38+
error: variable declared with type underscore
39+
--> $DIR/let_with_type_underscore.rs:18:5
40+
|
41+
LL | let x: _;
42+
| ^^^^^^^^^
43+
|
44+
help: remove the explicit type `_` declaration
45+
--> $DIR/let_with_type_underscore.rs:18:10
46+
|
47+
LL | let x: _;
48+
| ^^^
49+
50+
error: variable declared with type underscore
51+
--> $DIR/let_with_type_underscore.rs:25:5
52+
|
53+
LL | let x : _ = 1;
54+
| ^^^^^^^^^^^^^^
55+
|
56+
help: remove the explicit type `_` declaration
57+
--> $DIR/let_with_type_underscore.rs:25:10
58+
|
59+
LL | let x : _ = 1;
60+
| ^^^^
61+
62+
error: aborting due to 5 previous errors
3963

‎src/tools/clippy/tests/ui/redundant_clone.fixed‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@run-rustfix
22
// rustfix-only-machine-applicable
33
#![feature(lint_reasons)]
4+
#![warn(clippy::redundant_clone)]
45
#![allow(clippy::drop_non_drop, clippy::implicit_clone, clippy::uninlined_format_args)]
56

67
use std::ffi::OsString;

‎src/tools/clippy/tests/ui/redundant_clone.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@run-rustfix
22
// rustfix-only-machine-applicable
33
#![feature(lint_reasons)]
4+
#![warn(clippy::redundant_clone)]
45
#![allow(clippy::drop_non_drop, clippy::implicit_clone, clippy::uninlined_format_args)]
56

67
use std::ffi::OsString;

‎src/tools/clippy/tests/ui/redundant_clone.stderr‎

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,180 +1,180 @@
11
error: redundant clone
2-
--> $DIR/redundant_clone.rs:10:42
2+
--> $DIR/redundant_clone.rs:11:42
33
|
44
LL | let _s = ["lorem", "ipsum"].join(" ").to_string();
55
| ^^^^^^^^^^^^ help: remove this
66
|
77
note: this value is dropped without further use
8-
--> $DIR/redundant_clone.rs:10:14
8+
--> $DIR/redundant_clone.rs:11:14
99
|
1010
LL | let _s = ["lorem", "ipsum"].join(" ").to_string();
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
= note: `-D clippy::redundant-clone` implied by `-D warnings`
1313

1414
error: redundant clone
15-
--> $DIR/redundant_clone.rs:13:15
15+
--> $DIR/redundant_clone.rs:14:15
1616
|
1717
LL | let _s = s.clone();
1818
| ^^^^^^^^ help: remove this
1919
|
2020
note: this value is dropped without further use
21-
--> $DIR/redundant_clone.rs:13:14
21+
--> $DIR/redundant_clone.rs:14:14
2222
|
2323
LL | let _s = s.clone();
2424
| ^
2525

2626
error: redundant clone
27-
--> $DIR/redundant_clone.rs:16:15
27+
--> $DIR/redundant_clone.rs:17:15
2828
|
2929
LL | let _s = s.to_string();
3030
| ^^^^^^^^^^^^ help: remove this
3131
|
3232
note: this value is dropped without further use
33-
--> $DIR/redundant_clone.rs:16:14
33+
--> $DIR/redundant_clone.rs:17:14
3434
|
3535
LL | let _s = s.to_string();
3636
| ^
3737

3838
error: redundant clone
39-
--> $DIR/redundant_clone.rs:19:15
39+
--> $DIR/redundant_clone.rs:20:15
4040
|
4141
LL | let _s = s.to_owned();
4242
| ^^^^^^^^^^^ help: remove this
4343
|
4444
note: this value is dropped without further use
45-
--> $DIR/redundant_clone.rs:19:14
45+
--> $DIR/redundant_clone.rs:20:14
4646
|
4747
LL | let _s = s.to_owned();
4848
| ^
4949

5050
error: redundant clone
51-
--> $DIR/redundant_clone.rs:21:42
51+
--> $DIR/redundant_clone.rs:22:42
5252
|
5353
LL | let _s = Path::new("/a/b/").join("c").to_owned();
5454
| ^^^^^^^^^^^ help: remove this
5555
|
5656
note: this value is dropped without further use
57-
--> $DIR/redundant_clone.rs:21:14
57+
--> $DIR/redundant_clone.rs:22:14
5858
|
5959
LL | let _s = Path::new("/a/b/").join("c").to_owned();
6060
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6161

6262
error: redundant clone
63-
--> $DIR/redundant_clone.rs:23:42
63+
--> $DIR/redundant_clone.rs:24:42
6464
|
6565
LL | let _s = Path::new("/a/b/").join("c").to_path_buf();
6666
| ^^^^^^^^^^^^^^ help: remove this
6767
|
6868
note: this value is dropped without further use
69-
--> $DIR/redundant_clone.rs:23:14
69+
--> $DIR/redundant_clone.rs:24:14
7070
|
7171
LL | let _s = Path::new("/a/b/").join("c").to_path_buf();
7272
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7373

7474
error: redundant clone
75-
--> $DIR/redundant_clone.rs:25:29
75+
--> $DIR/redundant_clone.rs:26:29
7676
|
7777
LL | let _s = OsString::new().to_owned();
7878
| ^^^^^^^^^^^ help: remove this
7979
|
8080
note: this value is dropped without further use
81-
--> $DIR/redundant_clone.rs:25:14
81+
--> $DIR/redundant_clone.rs:26:14
8282
|
8383
LL | let _s = OsString::new().to_owned();
8484
| ^^^^^^^^^^^^^^^
8585

8686
error: redundant clone
87-
--> $DIR/redundant_clone.rs:27:29
87+
--> $DIR/redundant_clone.rs:28:29
8888
|
8989
LL | let _s = OsString::new().to_os_string();
9090
| ^^^^^^^^^^^^^^^ help: remove this
9191
|
9292
note: this value is dropped without further use
93-
--> $DIR/redundant_clone.rs:27:14
93+
--> $DIR/redundant_clone.rs:28:14
9494
|
9595
LL | let _s = OsString::new().to_os_string();
9696
| ^^^^^^^^^^^^^^^
9797

9898
error: redundant clone
99-
--> $DIR/redundant_clone.rs:38:19
99+
--> $DIR/redundant_clone.rs:39:19
100100
|
101101
LL | let _t = tup.0.clone();
102102
| ^^^^^^^^ help: remove this
103103
|
104104
note: this value is dropped without further use
105-
--> $DIR/redundant_clone.rs:38:14
105+
--> $DIR/redundant_clone.rs:39:14
106106
|
107107
LL | let _t = tup.0.clone();
108108
| ^^^^^
109109

110110
error: redundant clone
111-
--> $DIR/redundant_clone.rs:70:25
111+
--> $DIR/redundant_clone.rs:71:25
112112
|
113113
LL | if b { (a.clone(), a.clone()) } else { (Alpha, a) }
114114
| ^^^^^^^^ help: remove this
115115
|
116116
note: this value is dropped without further use
117-
--> $DIR/redundant_clone.rs:70:24
117+
--> $DIR/redundant_clone.rs:71:24
118118
|
119119
LL | if b { (a.clone(), a.clone()) } else { (Alpha, a) }
120120
| ^
121121

122122
error: redundant clone
123-
--> $DIR/redundant_clone.rs:127:15
123+
--> $DIR/redundant_clone.rs:128:15
124124
|
125125
LL | let _s = s.clone();
126126
| ^^^^^^^^ help: remove this
127127
|
128128
note: this value is dropped without further use
129-
--> $DIR/redundant_clone.rs:127:14
129+
--> $DIR/redundant_clone.rs:128:14
130130
|
131131
LL | let _s = s.clone();
132132
| ^
133133

134134
error: redundant clone
135-
--> $DIR/redundant_clone.rs:128:15
135+
--> $DIR/redundant_clone.rs:129:15
136136
|
137137
LL | let _t = t.clone();
138138
| ^^^^^^^^ help: remove this
139139
|
140140
note: this value is dropped without further use
141-
--> $DIR/redundant_clone.rs:128:14
141+
--> $DIR/redundant_clone.rs:129:14
142142
|
143143
LL | let _t = t.clone();
144144
| ^
145145

146146
error: redundant clone
147-
--> $DIR/redundant_clone.rs:138:19
147+
--> $DIR/redundant_clone.rs:139:19
148148
|
149149
LL | let _f = f.clone();
150150
| ^^^^^^^^ help: remove this
151151
|
152152
note: this value is dropped without further use
153-
--> $DIR/redundant_clone.rs:138:18
153+
--> $DIR/redundant_clone.rs:139:18
154154
|
155155
LL | let _f = f.clone();
156156
| ^
157157

158158
error: redundant clone
159-
--> $DIR/redundant_clone.rs:150:14
159+
--> $DIR/redundant_clone.rs:151:14
160160
|
161161
LL | let y = x.clone().join("matthias");
162162
| ^^^^^^^^ help: remove this
163163
|
164164
note: cloned value is neither consumed nor mutated
165-
--> $DIR/redundant_clone.rs:150:13
165+
--> $DIR/redundant_clone.rs:151:13
166166
|
167167
LL | let y = x.clone().join("matthias");
168168
| ^^^^^^^^^
169169

170170
error: redundant clone
171-
--> $DIR/redundant_clone.rs:204:11
171+
--> $DIR/redundant_clone.rs:205:11
172172
|
173173
LL | foo(&x.clone(), move || {
174174
| ^^^^^^^^ help: remove this
175175
|
176176
note: this value is dropped without further use
177-
--> $DIR/redundant_clone.rs:204:10
177+
--> $DIR/redundant_clone.rs:205:10
178178
|
179179
LL | foo(&x.clone(), move || {
180180
| ^

‎src/tools/clippy/tests/ui/unnecessary_to_owned.fixed‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@run-rustfix
22

33
#![allow(clippy::needless_borrow, clippy::ptr_arg)]
4-
#![warn(clippy::unnecessary_to_owned)]
4+
#![warn(clippy::unnecessary_to_owned, clippy::redundant_clone)]
55

66
use std::borrow::Cow;
77
use std::ffi::{CStr, CString, OsStr, OsString};

‎src/tools/clippy/tests/ui/unnecessary_to_owned.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@run-rustfix
22

33
#![allow(clippy::needless_borrow, clippy::ptr_arg)]
4-
#![warn(clippy::unnecessary_to_owned)]
4+
#![warn(clippy::unnecessary_to_owned, clippy::redundant_clone)]
55

66
use std::borrow::Cow;
77
use std::ffi::{CStr, CString, OsStr, OsString};

0 commit comments

Comments
 (0)
Please sign in to comment.