Fix unit_expr expectations and changelog entry

This commit is contained in:
Manish Goregaokar
2017-09-03 14:14:07 -07:00
parent e56da2782c
commit 35eda0531a
3 changed files with 33 additions and 26 deletions

View File

@@ -1,7 +1,10 @@
# Change Log # Change Log
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## 0.0.156 ## Master
* New lint: [`unit_expr`]
## 0.0.156 - 2017-09-03
* Update to *rustc 1.22.0-nightly (744dd6c1d 2017-09-02)* * Update to *rustc 1.22.0-nightly (744dd6c1d 2017-09-02)*
## 0.0.155 ## 0.0.155
@@ -602,6 +605,7 @@ All notable changes to this project will be documented in this file.
[`type_complexity`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#type_complexity [`type_complexity`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#type_complexity
[`unicode_not_nfc`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#unicode_not_nfc [`unicode_not_nfc`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#unicode_not_nfc
[`unit_cmp`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#unit_cmp [`unit_cmp`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#unit_cmp
[`unit_expr`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#unit_expr
[`unnecessary_cast`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#unnecessary_cast [`unnecessary_cast`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#unnecessary_cast
[`unnecessary_mut_passed`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#unnecessary_mut_passed [`unnecessary_mut_passed`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
[`unnecessary_operation`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#unnecessary_operation [`unnecessary_operation`]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#unnecessary_operation

View File

@@ -91,8 +91,8 @@ pub mod functions;
pub mod identity_op; pub mod identity_op;
pub mod if_let_redundant_pattern_matching; pub mod if_let_redundant_pattern_matching;
pub mod if_not_else; pub mod if_not_else;
pub mod is_unit_expr;
pub mod infinite_iter; pub mod infinite_iter;
pub mod is_unit_expr;
pub mod items_after_statements; pub mod items_after_statements;
pub mod large_enum_variant; pub mod large_enum_variant;
pub mod len_zero; pub mod len_zero;
@@ -423,6 +423,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
identity_op::IDENTITY_OP, identity_op::IDENTITY_OP,
if_let_redundant_pattern_matching::IF_LET_REDUNDANT_PATTERN_MATCHING, if_let_redundant_pattern_matching::IF_LET_REDUNDANT_PATTERN_MATCHING,
infinite_iter::INFINITE_ITER, infinite_iter::INFINITE_ITER,
is_unit_expr::UNIT_EXPR,
large_enum_variant::LARGE_ENUM_VARIANT, large_enum_variant::LARGE_ENUM_VARIANT,
len_zero::LEN_WITHOUT_IS_EMPTY, len_zero::LEN_WITHOUT_IS_EMPTY,
len_zero::LEN_ZERO, len_zero::LEN_ZERO,
@@ -506,7 +507,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
panic::PANIC_PARAMS, panic::PANIC_PARAMS,
partialeq_ne_impl::PARTIALEQ_NE_IMPL, partialeq_ne_impl::PARTIALEQ_NE_IMPL,
precedence::PRECEDENCE, precedence::PRECEDENCE,
is_unit_expr::UNIT_EXPR,
print::PRINT_WITH_NEWLINE, print::PRINT_WITH_NEWLINE,
ptr::CMP_NULL, ptr::CMP_NULL,
ptr::MUT_FROM_REF, ptr::MUT_FROM_REF,

View File

@@ -1,51 +1,54 @@
error: This expression evaluates to the Unit type () error: This expression evaluates to the Unit type ()
--> $DIR/is_unit_expr.rs:9:13 --> $DIR/is_unit_expr.rs:8:13
| |
9 | let x = { 8 | let x = {
| _____________^ | _____________^
10 | | "foo"; 9 | | "foo";
11 | | "baz"; 10 | | "baz";
12 | | }; 11 | | };
| |_____^ | |_____^
| |
= note: `-D unit-expr` implied by `-D warnings` = note: `-D unit-expr` implied by `-D warnings`
note: Consider removing the trailing semicolon note: Consider removing the trailing semicolon
--> $DIR/is_unit_expr.rs:11:9 --> $DIR/is_unit_expr.rs:10:9
| |
11 | "baz"; 10 | "baz";
| ^^^^^^ | ^^^^^^
error: This expression evaluates to the Unit type () error: This expression evaluates to the Unit type ()
--> $DIR/is_unit_expr.rs:23:13 --> $DIR/is_unit_expr.rs:22:13
| |
23 | let z = if true{ 22 | let z = if true {
| _____________^ | _____________^
24 | | "foo"; 23 | | "foo";
25 | | } else{ 24 | | } else {
26 | | "bar"; 25 | | "bar";
27 | | }; 26 | | };
| |_____^ | |_____^
| |
note: Consider removing the trailing semicolon note: Consider removing the trailing semicolon
--> $DIR/is_unit_expr.rs:26:9 --> $DIR/is_unit_expr.rs:25:9
| |
26 | "bar"; 25 | "bar";
| ^^^^^^ | ^^^^^^
error: This expression evaluates to the Unit type () error: This expression evaluates to the Unit type ()
--> $DIR/is_unit_expr.rs:39:14 --> $DIR/is_unit_expr.rs:40:14
| |
39 | let a3 = match a1 { 40 | let a3 = match a1 {
| ______________^ | ______________^
40 | | Some(x) => {x;}, 41 | | Some(x) => {
41 | | _ => {0;}, 42 | | x;
42 | | }; 43 | | },
... |
46 | | },
47 | | };
| |_____^ | |_____^
| |
note: Consider removing the trailing semicolon note: Consider removing the trailing semicolon
--> $DIR/is_unit_expr.rs:40:21 --> $DIR/is_unit_expr.rs:42:13
| |
40 | Some(x) => {x;}, 42 | x;
| ^^ | ^^
error: aborting due to 3 previous errors error: aborting due to 3 previous errors