mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
+2
-2
@@ -8,7 +8,7 @@
|
||||
/// **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 @@ fn check_arg_number(&self, cx: &LateContext, decl: &hir::FnDecl, span: Span) {
|
||||
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 @@ trait Foo {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user