First version of the lint

This commit is contained in:
Bastian Kersting 2020-12-20 11:48:56 +01:00
parent a507c27660
commit eb9c6698ee
5 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,18 @@
#![warn(clippy::semicolon_if_nothing_returned)]
fn get_unit() {}
// the functions below trigger the lint
fn main() {
println!("Hello")
}
fn hello() {
get_unit()
}
// this is fine
fn print_sum(a: i32, b: i32) {
println!("{}", a + b);
assert_eq!(true, false);
}

View file

@ -0,0 +1,17 @@
error: add `;` to terminate block
--> $DIR/semicolon_if_nothing_returned.rs:7:5
|
LL | println!("Hello")
| ^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::semicolon-if-nothing-returned` implied by `-D warnings`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: add `;` to terminate block
--> $DIR/semicolon_if_nothing_returned.rs:11:5
|
LL | get_unit()
| ^^^^^^^^^^ help: add `;`: `get_unit();`
error: aborting due to 2 previous errors