Skip to content

Commit d280f76

Browse files
committed
fix dogfood test
1 parent 48aec1c commit d280f76

File tree

58 files changed

+224
-198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+224
-198
lines changed

clippy_lints/src/let_arr_const.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@ impl<'tcx> LateLintPass<'tcx> for LetArrConst {
9090
if let ExprKind::Array(items @ [ref expr, ..]) = init.kind
9191
&& let ty = cx.typeck_results().expr_ty(expr)
9292
&& implements_trait(cx, ty, copy_id, &[])
93+
&& items.iter().all(|expr| is_const_evaluatable(cx, expr))
9394
{
94-
if items.iter().all(|expr| is_const_evaluatable(cx, expr)) {
95-
should = true;
96-
}
95+
should = true;
9796
}
9897

9998
if should {

clippy_lints/src/methods/option_as_ref_deref.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ pub(super) fn check(
2020
is_mut: bool,
2121
msrv: &Msrv,
2222
) {
23+
static DEREF_ALIASES: [&[&str]; 7] = [
24+
&paths::CSTRING_AS_C_STR,
25+
&paths::OS_STRING_AS_OS_STR,
26+
&paths::PATH_BUF_AS_PATH,
27+
&paths::STRING_AS_STR,
28+
&paths::STRING_AS_MUT_STR,
29+
&paths::VEC_AS_SLICE,
30+
&paths::VEC_AS_MUT_SLICE,
31+
];
32+
2333
if !msrv.meets(msrvs::OPTION_AS_DEREF) {
2434
return;
2535
}
@@ -31,24 +41,14 @@ pub(super) fn check(
3141
return;
3242
}
3343

34-
let deref_aliases: [&[&str]; 7] = [
35-
&paths::CSTRING_AS_C_STR,
36-
&paths::OS_STRING_AS_OS_STR,
37-
&paths::PATH_BUF_AS_PATH,
38-
&paths::STRING_AS_STR,
39-
&paths::STRING_AS_MUT_STR,
40-
&paths::VEC_AS_SLICE,
41-
&paths::VEC_AS_MUT_SLICE,
42-
];
43-
4444
let is_deref = match map_arg.kind {
4545
hir::ExprKind::Path(ref expr_qpath) => {
4646
cx.qpath_res(expr_qpath, map_arg.hir_id)
4747
.opt_def_id()
4848
.map_or(false, |fun_def_id| {
4949
cx.tcx.is_diagnostic_item(sym::deref_method, fun_def_id)
5050
|| cx.tcx.is_diagnostic_item(sym::deref_mut_method, fun_def_id)
51-
|| deref_aliases.iter().any(|path| match_def_path(cx, fun_def_id, path))
51+
|| DEREF_ALIASES.iter().any(|path| match_def_path(cx, fun_def_id, path))
5252
})
5353
},
5454
hir::ExprKind::Closure(&hir::Closure { body, .. }) => {
@@ -69,7 +69,7 @@ pub(super) fn check(
6969
let method_did = cx.typeck_results().type_dependent_def_id(closure_expr.hir_id).unwrap();
7070
cx.tcx.is_diagnostic_item(sym::deref_method, method_did)
7171
|| cx.tcx.is_diagnostic_item(sym::deref_mut_method, method_did)
72-
|| deref_aliases.iter().any(|path| match_def_path(cx, method_did, path))
72+
|| DEREF_ALIASES.iter().any(|path| match_def_path(cx, method_did, path))
7373
} else {
7474
false
7575
}

lintcheck/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ fn clippy_project_root() -> &'static Path {
855855

856856
#[test]
857857
fn lintcheck_test() {
858-
let args = [
858+
let args = *&[
859859
"run",
860860
"--target-dir",
861861
"lintcheck/target",

tests/ui-toml/disallowed_names_append/disallowed_names.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#[warn(clippy::disallowed_names)]
1+
#![warn(clippy::disallowed_names)]
2+
#![allow(clippy::let_arr_const)]
23

34
fn main() {
45
// `foo` is part of the default configuration

tests/ui-toml/disallowed_names_append/disallowed_names.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: use of a disallowed/placeholder name `foo`
2-
--> tests/ui-toml/disallowed_names_append/disallowed_names.rs:5:9
2+
--> tests/ui-toml/disallowed_names_append/disallowed_names.rs:6:9
33
|
44
LL | let foo = "bar";
55
| ^^^
@@ -8,7 +8,7 @@ LL | let foo = "bar";
88
= help: to override `-D warnings` add `#[allow(clippy::disallowed_names)]`
99

1010
error: use of a disallowed/placeholder name `ducks`
11-
--> tests/ui-toml/disallowed_names_append/disallowed_names.rs:7:9
11+
--> tests/ui-toml/disallowed_names_append/disallowed_names.rs:8:9
1212
|
1313
LL | let ducks = ["quack", "quack"];
1414
| ^^^^^

tests/ui-toml/disallowed_names_replace/disallowed_names.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#[warn(clippy::disallowed_names)]
1+
#![warn(clippy::disallowed_names)]
2+
#![allow(clippy::let_arr_const)]
23

34
fn main() {
45
// `foo` is part of the default configuration

tests/ui-toml/disallowed_names_replace/disallowed_names.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: use of a disallowed/placeholder name `ducks`
2-
--> tests/ui-toml/disallowed_names_replace/disallowed_names.rs:7:9
2+
--> tests/ui-toml/disallowed_names_replace/disallowed_names.rs:8:9
33
|
44
LL | let ducks = ["quack", "quack"];
55
| ^^^^^

tests/ui-toml/large_futures/large_futures.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::large_futures)]
2+
#![allow(clippy::let_arr_const)]
23

34
fn main() {}
45

tests/ui-toml/large_futures/large_futures.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::large_futures)]
2+
#![allow(clippy::let_arr_const)]
23

34
fn main() {}
45

tests/ui-toml/large_futures/large_futures.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: large future with a size of 1026 bytes
2-
--> tests/ui-toml/large_futures/large_futures.rs:18:5
2+
--> tests/ui-toml/large_futures/large_futures.rs:19:5
33
|
44
LL | should_warn().await;
55
| ^^^^^^^^^^^^^ help: consider `Box::pin` on it: `Box::pin(should_warn())`

tests/ui-toml/too_large_for_stack/useless_vec.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::useless_vec)]
2+
#![allow(clippy::let_arr_const)]
23

34
fn main() {
45
let x = [0u8; 500];

tests/ui-toml/too_large_for_stack/useless_vec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::useless_vec)]
2+
#![allow(clippy::let_arr_const)]
23

34
fn main() {
45
let x = vec![0u8; 500];

tests/ui-toml/too_large_for_stack/useless_vec.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: useless use of `vec!`
2-
--> tests/ui-toml/too_large_for_stack/useless_vec.rs:4:13
2+
--> tests/ui-toml/too_large_for_stack/useless_vec.rs:5:13
33
|
44
LL | let x = vec![0u8; 500];
55
| ^^^^^^^^^^^^^^ help: you can use an array directly: `[0u8; 500]`

tests/ui/crashes/ice-12253.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#[allow(overflowing_literals, unconditional_panic, clippy::no_effect)]
1+
#[allow(overflowing_literals, unconditional_panic, clippy::no_effect, clippy::let_arr_const)]
22
fn main() {
33
let arr: [i32; 5] = [0; 5];
44
arr[0xfffffe7ffffffffffffffffffffffff];

tests/ui/crashes/ice-5389.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(clippy::explicit_counter_loop)]
1+
#![allow(clippy::explicit_counter_loop, clippy::let_arr_const)]
22

33
fn main() {
44
let v = vec![1, 2, 3];

tests/ui/default_numeric_fallback_f64.fixed

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
clippy::branches_sharing_code,
1010
clippy::match_single_binding,
1111
clippy::let_unit_value,
12-
clippy::let_with_type_underscore
12+
clippy::let_with_type_underscore,
13+
clippy::let_arr_const
1314
)]
1415

1516
extern crate proc_macros;

tests/ui/default_numeric_fallback_f64.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
clippy::branches_sharing_code,
1010
clippy::match_single_binding,
1111
clippy::let_unit_value,
12-
clippy::let_with_type_underscore
12+
clippy::let_with_type_underscore,
13+
clippy::let_arr_const
1314
)]
1415

1516
extern crate proc_macros;

tests/ui/default_numeric_fallback_f64.stderr

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: default numeric fallback might occur
2-
--> tests/ui/default_numeric_fallback_f64.rs:21:17
2+
--> tests/ui/default_numeric_fallback_f64.rs:22:17
33
|
44
LL | let x = 0.12;
55
| ^^^^ help: consider adding suffix: `0.12_f64`
@@ -8,133 +8,133 @@ LL | let x = 0.12;
88
= help: to override `-D warnings` add `#[allow(clippy::default_numeric_fallback)]`
99

1010
error: default numeric fallback might occur
11-
--> tests/ui/default_numeric_fallback_f64.rs:22:18
11+
--> tests/ui/default_numeric_fallback_f64.rs:23:18
1212
|
1313
LL | let x = [1., 2., 3.];
1414
| ^^ help: consider adding suffix: `1.0_f64`
1515

1616
error: default numeric fallback might occur
17-
--> tests/ui/default_numeric_fallback_f64.rs:22:22
17+
--> tests/ui/default_numeric_fallback_f64.rs:23:22
1818
|
1919
LL | let x = [1., 2., 3.];
2020
| ^^ help: consider adding suffix: `2.0_f64`
2121

2222
error: default numeric fallback might occur
23-
--> tests/ui/default_numeric_fallback_f64.rs:22:26
23+
--> tests/ui/default_numeric_fallback_f64.rs:23:26
2424
|
2525
LL | let x = [1., 2., 3.];
2626
| ^^ help: consider adding suffix: `3.0_f64`
2727

2828
error: default numeric fallback might occur
29-
--> tests/ui/default_numeric_fallback_f64.rs:23:28
29+
--> tests/ui/default_numeric_fallback_f64.rs:24:28
3030
|
3131
LL | let x = if true { (1., 2.) } else { (3., 4.) };
3232
| ^^ help: consider adding suffix: `1.0_f64`
3333

3434
error: default numeric fallback might occur
35-
--> tests/ui/default_numeric_fallback_f64.rs:23:32
35+
--> tests/ui/default_numeric_fallback_f64.rs:24:32
3636
|
3737
LL | let x = if true { (1., 2.) } else { (3., 4.) };
3838
| ^^ help: consider adding suffix: `2.0_f64`
3939

4040
error: default numeric fallback might occur
41-
--> tests/ui/default_numeric_fallback_f64.rs:23:46
41+
--> tests/ui/default_numeric_fallback_f64.rs:24:46
4242
|
4343
LL | let x = if true { (1., 2.) } else { (3., 4.) };
4444
| ^^ help: consider adding suffix: `3.0_f64`
4545

4646
error: default numeric fallback might occur
47-
--> tests/ui/default_numeric_fallback_f64.rs:23:50
47+
--> tests/ui/default_numeric_fallback_f64.rs:24:50
4848
|
4949
LL | let x = if true { (1., 2.) } else { (3., 4.) };
5050
| ^^ help: consider adding suffix: `4.0_f64`
5151

5252
error: default numeric fallback might occur
53-
--> tests/ui/default_numeric_fallback_f64.rs:24:23
53+
--> tests/ui/default_numeric_fallback_f64.rs:25:23
5454
|
5555
LL | let x = match 1. {
5656
| ^^ help: consider adding suffix: `1.0_f64`
5757

5858
error: default numeric fallback might occur
59-
--> tests/ui/default_numeric_fallback_f64.rs:25:18
59+
--> tests/ui/default_numeric_fallback_f64.rs:26:18
6060
|
6161
LL | _ => 1.,
6262
| ^^ help: consider adding suffix: `1.0_f64`
6363

6464
error: default numeric fallback might occur
65-
--> tests/ui/default_numeric_fallback_f64.rs:44:21
65+
--> tests/ui/default_numeric_fallback_f64.rs:45:21
6666
|
6767
LL | let y = 1.;
6868
| ^^ help: consider adding suffix: `1.0_f64`
6969

7070
error: default numeric fallback might occur
71-
--> tests/ui/default_numeric_fallback_f64.rs:52:21
71+
--> tests/ui/default_numeric_fallback_f64.rs:53:21
7272
|
7373
LL | let y = 1.;
7474
| ^^ help: consider adding suffix: `1.0_f64`
7575

7676
error: default numeric fallback might occur
77-
--> tests/ui/default_numeric_fallback_f64.rs:58:21
77+
--> tests/ui/default_numeric_fallback_f64.rs:59:21
7878
|
7979
LL | let y = 1.;
8080
| ^^ help: consider adding suffix: `1.0_f64`
8181

8282
error: default numeric fallback might occur
83-
--> tests/ui/default_numeric_fallback_f64.rs:66:21
83+
--> tests/ui/default_numeric_fallback_f64.rs:67:21
8484
|
8585
LL | let y = 1.;
8686
| ^^ help: consider adding suffix: `1.0_f64`
8787

8888
error: default numeric fallback might occur
89-
--> tests/ui/default_numeric_fallback_f64.rs:82:27
89+
--> tests/ui/default_numeric_fallback_f64.rs:83:27
9090
|
9191
LL | let f = || -> _ { 1. };
9292
| ^^ help: consider adding suffix: `1.0_f64`
9393

9494
error: default numeric fallback might occur
95-
--> tests/ui/default_numeric_fallback_f64.rs:86:29
95+
--> tests/ui/default_numeric_fallback_f64.rs:87:29
9696
|
9797
LL | let f = || -> f64 { 1. };
9898
| ^^ help: consider adding suffix: `1.0_f64`
9999

100100
error: default numeric fallback might occur
101-
--> tests/ui/default_numeric_fallback_f64.rs:100:21
101+
--> tests/ui/default_numeric_fallback_f64.rs:101:21
102102
|
103103
LL | generic_arg(1.);
104104
| ^^ help: consider adding suffix: `1.0_f64`
105105

106106
error: default numeric fallback might occur
107-
--> tests/ui/default_numeric_fallback_f64.rs:103:32
107+
--> tests/ui/default_numeric_fallback_f64.rs:104:32
108108
|
109109
LL | let x: _ = generic_arg(1.);
110110
| ^^ help: consider adding suffix: `1.0_f64`
111111

112112
error: default numeric fallback might occur
113-
--> tests/ui/default_numeric_fallback_f64.rs:121:28
113+
--> tests/ui/default_numeric_fallback_f64.rs:122:28
114114
|
115115
LL | GenericStruct { x: 1. };
116116
| ^^ help: consider adding suffix: `1.0_f64`
117117

118118
error: default numeric fallback might occur
119-
--> tests/ui/default_numeric_fallback_f64.rs:124:36
119+
--> tests/ui/default_numeric_fallback_f64.rs:125:36
120120
|
121121
LL | let _ = GenericStruct { x: 1. };
122122
| ^^ help: consider adding suffix: `1.0_f64`
123123

124124
error: default numeric fallback might occur
125-
--> tests/ui/default_numeric_fallback_f64.rs:142:24
125+
--> tests/ui/default_numeric_fallback_f64.rs:143:24
126126
|
127127
LL | GenericEnum::X(1.);
128128
| ^^ help: consider adding suffix: `1.0_f64`
129129

130130
error: default numeric fallback might occur
131-
--> tests/ui/default_numeric_fallback_f64.rs:162:23
131+
--> tests/ui/default_numeric_fallback_f64.rs:163:23
132132
|
133133
LL | s.generic_arg(1.);
134134
| ^^ help: consider adding suffix: `1.0_f64`
135135

136136
error: default numeric fallback might occur
137-
--> tests/ui/default_numeric_fallback_f64.rs:172:25
137+
--> tests/ui/default_numeric_fallback_f64.rs:173:25
138138
|
139139
LL | inline!(let x = 22.;);
140140
| ^^^ help: consider adding suffix: `22.0_f64`

tests/ui/explicit_counter_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::explicit_counter_loop)]
2-
#![allow(clippy::uninlined_format_args, clippy::useless_vec)]
2+
#![allow(clippy::uninlined_format_args, clippy::useless_vec, clippy::let_arr_const)]
33
//@no-rustfix
44
fn main() {
55
let mut vec = vec![1, 2, 3, 4];

tests/ui/filter_map_next.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![warn(clippy::all, clippy::pedantic)]
22

33
fn main() {
4-
let a = ["1", "lol", "3", "NaN", "5"];
4+
let a = *&["1", "lol", "3", "NaN", "5"];
55

66
#[rustfmt::skip]
77
let _: Option<u32> = vec![1, 2, 3, 4, 5, 6]

tests/ui/filter_map_next_fixable.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::all, clippy::pedantic)]
2-
#![allow(unused)]
2+
#![allow(unused, clippy::let_arr_const)]
33

44
fn main() {
55
let a = ["1", "lol", "3", "NaN", "5"];

tests/ui/filter_map_next_fixable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::all, clippy::pedantic)]
2-
#![allow(unused)]
2+
#![allow(unused, clippy::let_arr_const)]
33

44
fn main() {
55
let a = ["1", "lol", "3", "NaN", "5"];

tests/ui/find_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ enum Dessert {
1616
fn main() {
1717
let desserts_of_the_week = vec![Dessert::Banana, Dessert::Cake(Flavor::Chocolate), Dessert::Pudding];
1818

19-
let a = ["lol", "NaN", "2", "5", "Xunda"];
19+
let a = *&["lol", "NaN", "2", "5", "Xunda"];
2020

2121
let _: Option<i32> = a.iter().find(|s| s.parse::<i32>().is_ok()).map(|s| s.parse().unwrap());
2222

tests/ui/from_iter_instead_of_collect.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn main() {
4242
b.push_back(4);
4343
}
4444

45-
let values = [(0, 'a'), (1, 'b'), (2, 'c'), (3, 'd')];
45+
let values = *&[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'd')];
4646
let bm = values.iter().cloned().collect::<BTreeMap<_, _>>();
4747
let mut bar = bm.range(0..2).collect::<BTreeMap<_, _>>();
4848
bar.insert(&4, &'e');

0 commit comments

Comments
 (0)