Skip to content

Commit e3022dd

Browse files
A.A.AbroskinGrzegorz
A.A.Abroskin
authored and
Grzegorz
committed
allow assertions_on_constants for collapsible_if and missing_test_files
1 parent cd8e446 commit e3022dd

9 files changed

+13
-29
lines changed

clippy_lints/src/assertions_on_constants.rs

-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2-
// file at the top-level directory of this distribution.
3-
//
4-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7-
// option. This file may not be copied, modified, or distributed
8-
// except according to those terms.
9-
101
use crate::consts::{constant, Constant};
112
use crate::rustc::hir::{Expr, ExprKind};
123
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};

tests/missing-test-files.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::assertions_on_constants)]
2+
13
use std::fs::{self, DirEntry};
24
use std::path::Path;
35

tests/ui/assertions_on_constants.rs

-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2-
// file at the top-level directory of this distribution.
3-
//
4-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7-
// option. This file may not be copied, modified, or distributed
8-
// except according to those terms.
9-
101
fn main() {
112
assert!(true);
123
assert!(false);

tests/ui/assertions_on_constants.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: assert!(true) will be optimized out by the compiler
2-
--> $DIR/assertions_on_constants.rs:11:5
2+
--> $DIR/assertions_on_constants.rs:2:5
33
|
44
LL | assert!(true);
55
| ^^^^^^^^^^^^^^
@@ -8,39 +8,39 @@ LL | assert!(true);
88
= help: remove it
99

1010
error: assert!(false) should probably be replaced
11-
--> $DIR/assertions_on_constants.rs:12:5
11+
--> $DIR/assertions_on_constants.rs:3:5
1212
|
1313
LL | assert!(false);
1414
| ^^^^^^^^^^^^^^^
1515
|
1616
= help: use panic!() or unreachable!()
1717

1818
error: assert!(true) will be optimized out by the compiler
19-
--> $DIR/assertions_on_constants.rs:13:5
19+
--> $DIR/assertions_on_constants.rs:4:5
2020
|
2121
LL | assert!(true, "true message");
2222
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2323
|
2424
= help: remove it
2525

2626
error: assert!(false) should probably be replaced
27-
--> $DIR/assertions_on_constants.rs:14:5
27+
--> $DIR/assertions_on_constants.rs:5:5
2828
|
2929
LL | assert!(false, "false message");
3030
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3131
|
3232
= help: use panic!() or unreachable!()
3333

3434
error: assert!(const: true) will be optimized out by the compiler
35-
--> $DIR/assertions_on_constants.rs:17:5
35+
--> $DIR/assertions_on_constants.rs:8:5
3636
|
3737
LL | assert!(B);
3838
| ^^^^^^^^^^^
3939
|
4040
= help: remove it
4141

4242
error: assert!(const: false) should probably be replaced
43-
--> $DIR/assertions_on_constants.rs:20:5
43+
--> $DIR/assertions_on_constants.rs:11:5
4444
|
4545
LL | assert!(C);
4646
| ^^^^^^^^^^^

tests/ui/attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::inline_always, clippy::deprecated_semver)]
2-
#![allow(clippy::assertions_on_constants::assertions_on_constants)]
2+
#![allow(clippy::assertions_on_constants)]
33
#[inline(always)]
44
fn test_attr_lint() {
55
assert!(true)

tests/ui/collapsible_if.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![allow(clippy::cyclomatic_complexity)]
2+
#![allow(clippy::cyclomatic_complexity, clippy::assertions_on_constants)]
33

44
#[rustfmt::skip]
55
#[warn(clippy::collapsible_if)]

tests/ui/collapsible_if.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![allow(clippy::cyclomatic_complexity)]
2+
#![allow(clippy::cyclomatic_complexity, clippy::assertions_on_constants)]
33

44
#[rustfmt::skip]
55
#[warn(clippy::collapsible_if)]

tests/ui/empty_line_after_outer_attribute.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::empty_line_after_outer_attr)]
2-
#![allow(clippy::assertions_on_constants::assertions_on_constants)]
2+
#![allow(clippy::assertions_on_constants)]
33
// This should produce a warning
44
#[crate_type = "lib"]
55

tests/ui/panic_unimplemented.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::panic_params, clippy::unimplemented)]
2-
#![allow(clippy::assertions_on_constants::assertions_on_constants)]
2+
#![allow(clippy::assertions_on_constants)]
33
fn missing() {
44
if true {
55
panic!("{}");

0 commit comments

Comments
 (0)