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())`

0 commit comments

Comments
 (0)