Skip to content

Commit

Permalink
allow assertions_on_constants for collapsible_if and missing_test_files
Browse files Browse the repository at this point in the history
  • Loading branch information
A.A.Abroskin committed Jan 23, 2019
1 parent f11d993 commit c771f33
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 29 deletions.
9 changes: 0 additions & 9 deletions clippy_lints/src/assertions_on_constants.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use crate::consts::{constant, Constant};
use crate::rustc::hir::{Expr, ExprKind};
use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
Expand Down
2 changes: 2 additions & 0 deletions tests/missing-test-files.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::assertions_on_constants)]

use std::fs::{self, DirEntry};
use std::path::Path;

Expand Down
9 changes: 0 additions & 9 deletions tests/ui/assertions_on_constants.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn main() {
assert!(true);
assert!(false);
Expand Down
12 changes: 6 additions & 6 deletions tests/ui/assertions_on_constants.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: assert!(true) will be optimized out by the compiler
--> $DIR/assertions_on_constants.rs:11:5
--> $DIR/assertions_on_constants.rs:2:5
|
LL | assert!(true);
| ^^^^^^^^^^^^^^
Expand All @@ -8,39 +8,39 @@ LL | assert!(true);
= help: remove it

error: assert!(false) should probably be replaced
--> $DIR/assertions_on_constants.rs:12:5
--> $DIR/assertions_on_constants.rs:3:5
|
LL | assert!(false);
| ^^^^^^^^^^^^^^^
|
= help: use panic!() or unreachable!()

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

error: assert!(false) should probably be replaced
--> $DIR/assertions_on_constants.rs:14:5
--> $DIR/assertions_on_constants.rs:5:5
|
LL | assert!(false, "false message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use panic!() or unreachable!()

error: assert!(const: true) will be optimized out by the compiler
--> $DIR/assertions_on_constants.rs:17:5
--> $DIR/assertions_on_constants.rs:8:5
|
LL | assert!(B);
| ^^^^^^^^^^^
|
= help: remove it

error: assert!(const: false) should probably be replaced
--> $DIR/assertions_on_constants.rs:20:5
--> $DIR/assertions_on_constants.rs:11:5
|
LL | assert!(C);
| ^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/attrs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::inline_always, clippy::deprecated_semver)]
#![allow(clippy::assertions_on_constants::assertions_on_constants)]
#![allow(clippy::assertions_on_constants)]
#[inline(always)]
fn test_attr_lint() {
assert!(true)
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/collapsible_if.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
#![allow(clippy::cyclomatic_complexity)]
#![allow(clippy::cyclomatic_complexity, clippy::assertions_on_constants)]

#[rustfmt::skip]
#[warn(clippy::collapsible_if)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/collapsible_if.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
#![allow(clippy::cyclomatic_complexity)]
#![allow(clippy::cyclomatic_complexity, clippy::assertions_on_constants)]

#[rustfmt::skip]
#[warn(clippy::collapsible_if)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/empty_line_after_outer_attribute.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::empty_line_after_outer_attr)]
#![allow(clippy::assertions_on_constants::assertions_on_constants)]
#![allow(clippy::assertions_on_constants)]
// This should produce a warning
#[crate_type = "lib"]

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/panic_unimplemented.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::panic_params, clippy::unimplemented)]
#![allow(clippy::assertions_on_constants::assertions_on_constants)]
#![allow(clippy::assertions_on_constants)]
fn missing() {
if true {
panic!("{}");
Expand Down

0 comments on commit c771f33

Please sign in to comment.