rust-clippy/tests/compile-fail/functions.rs

34 lines
1.2 KiB
Rust
Raw Normal View History

2016-03-08 23:48:10 +00:00
#![feature(plugin)]
#![plugin(clippy)]
#![deny(clippy)]
#![allow(dead_code)]
fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}
fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {
2016-05-12 15:52:51 +00:00
//~^ ERROR: this function has too many arguments (8/7)
2016-03-08 23:48:10 +00:00
}
trait Foo {
fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool);
fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ());
2016-05-12 15:52:51 +00:00
//~^ ERROR: this function has too many arguments (8/7)
2016-03-08 23:48:10 +00:00
}
struct Bar;
impl Bar {
fn good_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}
fn bad_method(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
2016-05-12 15:52:51 +00:00
//~^ ERROR: this function has too many arguments (8/7)
2016-03-08 23:48:10 +00:00
}
// ok, we dont want to warn implementations
impl Foo for Bar {
fn good(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool) {}
fn bad(_one: u32, _two: u32, _three: &str, _four: bool, _five: f32, _six: f32, _seven: bool, _eight: ()) {}
}
fn main() {}