commit
e890bb5e4b
@ -8,7 +8,7 @@ use utils::span_lint;
|
||||
/// **What it does:** Check for functions with too many parameters.
|
||||
///
|
||||
/// **Why is this bad?** Functions with lots of parameters are considered bad style and reduce
|
||||
/// readability (“what does the 5th parameter means?”). Consider grouping some parameters into a
|
||||
/// readability (“what does the 5th parameter mean?”). Consider grouping some parameters into a
|
||||
/// new type.
|
||||
///
|
||||
/// **Known problems:** None.
|
||||
@ -70,7 +70,7 @@ impl Functions {
|
||||
span_lint(cx,
|
||||
TOO_MANY_ARGUMENTS,
|
||||
span,
|
||||
&format!("this function has to many arguments ({}/{})", args, self.threshold));
|
||||
&format!("this function has too many arguments ({}/{})", args, self.threshold));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,13 +7,13 @@
|
||||
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: ()) {
|
||||
//~^ ERROR: this function has to many arguments (8/7)
|
||||
//~^ ERROR: this function has too many arguments (8/7)
|
||||
}
|
||||
|
||||
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: ());
|
||||
//~^ ERROR: this function has to many arguments (8/7)
|
||||
//~^ ERROR: this function has too many arguments (8/7)
|
||||
}
|
||||
|
||||
struct Bar;
|
||||
@ -21,7 +21,7 @@ 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: ()) {}
|
||||
//~^ ERROR: this function has to many arguments (8/7)
|
||||
//~^ ERROR: this function has too many arguments (8/7)
|
||||
}
|
||||
|
||||
// ok, we don’t want to warn implementations
|
||||
|
Loading…
Reference in New Issue
Block a user