mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 05:03:21 +00:00
Fix case conventions
This commit is contained in:
parent
0494071ab7
commit
70124cf591
6 changed files with 37 additions and 37 deletions
|
@ -62,8 +62,8 @@ impl CyclomaticComplexity {
|
|||
span_help_and_lint(cx,
|
||||
CYCLOMATIC_COMPLEXITY,
|
||||
span,
|
||||
&format!("The function has a cyclomatic complexity of {}", rust_cc),
|
||||
"You could split it up into multiple smaller functions");
|
||||
&format!("the function has a cyclomatic complexity of {}", rust_cc),
|
||||
"you could split it up into multiple smaller functions");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ fn check_open_options(cx: &LateContext, options: &[(OpenOption, Argument)], span
|
|||
span_lint(cx,
|
||||
NONSENSICAL_OPEN_OPTIONS,
|
||||
span,
|
||||
"The method \"create\" is called more than once");
|
||||
"the method \"create\" is called more than once");
|
||||
} else {
|
||||
create = true
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ fn check_open_options(cx: &LateContext, options: &[(OpenOption, Argument)], span
|
|||
span_lint(cx,
|
||||
NONSENSICAL_OPEN_OPTIONS,
|
||||
span,
|
||||
"The method \"append\" is called more than once");
|
||||
"the method \"append\" is called more than once");
|
||||
} else {
|
||||
append = true
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ fn check_open_options(cx: &LateContext, options: &[(OpenOption, Argument)], span
|
|||
span_lint(cx,
|
||||
NONSENSICAL_OPEN_OPTIONS,
|
||||
span,
|
||||
"The method \"truncate\" is called more than once");
|
||||
"the method \"truncate\" is called more than once");
|
||||
} else {
|
||||
truncate = true
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ fn check_open_options(cx: &LateContext, options: &[(OpenOption, Argument)], span
|
|||
span_lint(cx,
|
||||
NONSENSICAL_OPEN_OPTIONS,
|
||||
span,
|
||||
"The method \"read\" is called more than once");
|
||||
"the method \"read\" is called more than once");
|
||||
} else {
|
||||
read = true
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ fn check_open_options(cx: &LateContext, options: &[(OpenOption, Argument)], span
|
|||
span_lint(cx,
|
||||
NONSENSICAL_OPEN_OPTIONS,
|
||||
span,
|
||||
"The method \"write\" is called more than once");
|
||||
"the method \"write\" is called more than once");
|
||||
} else {
|
||||
write = true
|
||||
}
|
||||
|
@ -174,12 +174,12 @@ fn check_open_options(cx: &LateContext, options: &[(OpenOption, Argument)], span
|
|||
}
|
||||
|
||||
if read && truncate && read_arg && truncate_arg {
|
||||
span_lint(cx, NONSENSICAL_OPEN_OPTIONS, span, "File opened with \"truncate\" and \"read\"");
|
||||
span_lint(cx, NONSENSICAL_OPEN_OPTIONS, span, "file opened with \"truncate\" and \"read\"");
|
||||
}
|
||||
if append && truncate && append_arg && truncate_arg {
|
||||
span_lint(cx,
|
||||
NONSENSICAL_OPEN_OPTIONS,
|
||||
span,
|
||||
"File opened with \"append\" and \"truncate\"");
|
||||
"file opened with \"append\" and \"truncate\"");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ impl LateLintPass for RegexPass {
|
|||
span_lint(cx,
|
||||
INVALID_REGEX,
|
||||
str_span(args[0].span, &r, e.position()),
|
||||
&format!("Regex syntax error: {}",
|
||||
&format!("regex syntax error: {}",
|
||||
e.description()));
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ impl LateLintPass for RegexPass {
|
|||
span_lint(cx,
|
||||
INVALID_REGEX,
|
||||
args[0].span,
|
||||
&format!("Regex syntax error on position {}: {}",
|
||||
&format!("regex syntax error on position {}: {}",
|
||||
e.position(),
|
||||
e.description()));
|
||||
}}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#![allow(unused)]
|
||||
|
||||
|
||||
fn main() { //~ERROR The function has a cyclomatic complexity of 28
|
||||
fn main() { //~ERROR the function has a cyclomatic complexity of 28
|
||||
if true {
|
||||
println!("a");
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ fn main() { //~ERROR The function has a cyclomatic complexity of 28
|
|||
}
|
||||
|
||||
#[cyclomatic_complexity = "0"]
|
||||
fn kaboom() { //~ ERROR: The function has a cyclomatic complexity of 8
|
||||
fn kaboom() { //~ ERROR: the function has a cyclomatic complexity of 8
|
||||
let n = 0;
|
||||
'a: for i in 0..20 {
|
||||
'b: for j in i..20 {
|
||||
|
@ -136,7 +136,7 @@ fn bloo() {
|
|||
}
|
||||
|
||||
#[cyclomatic_complexity = "0"]
|
||||
fn baa() { //~ ERROR: The function has a cyclomatic complexity of 2
|
||||
fn baa() { //~ ERROR: the function has a cyclomatic complexity of 2
|
||||
let x = || match 99 {
|
||||
0 => true,
|
||||
1 => false,
|
||||
|
@ -154,7 +154,7 @@ fn baa() { //~ ERROR: The function has a cyclomatic complexity of 2
|
|||
}
|
||||
|
||||
#[cyclomatic_complexity = "0"]
|
||||
fn bar() { //~ ERROR: The function has a cyclomatic complexity of 2
|
||||
fn bar() { //~ ERROR: the function has a cyclomatic complexity of 2
|
||||
match 99 {
|
||||
0 => println!("hi"),
|
||||
_ => println!("bye"),
|
||||
|
@ -162,7 +162,7 @@ fn bar() { //~ ERROR: The function has a cyclomatic complexity of 2
|
|||
}
|
||||
|
||||
#[cyclomatic_complexity = "0"]
|
||||
fn barr() { //~ ERROR: The function has a cyclomatic complexity of 2
|
||||
fn barr() { //~ ERROR: the function has a cyclomatic complexity of 2
|
||||
match 99 {
|
||||
0 => println!("hi"),
|
||||
1 => println!("bla"),
|
||||
|
@ -172,7 +172,7 @@ fn barr() { //~ ERROR: The function has a cyclomatic complexity of 2
|
|||
}
|
||||
|
||||
#[cyclomatic_complexity = "0"]
|
||||
fn barr2() { //~ ERROR: The function has a cyclomatic complexity of 3
|
||||
fn barr2() { //~ ERROR: the function has a cyclomatic complexity of 3
|
||||
match 99 {
|
||||
0 => println!("hi"),
|
||||
1 => println!("bla"),
|
||||
|
@ -188,7 +188,7 @@ fn barr2() { //~ ERROR: The function has a cyclomatic complexity of 3
|
|||
}
|
||||
|
||||
#[cyclomatic_complexity = "0"]
|
||||
fn barrr() { //~ ERROR: The function has a cyclomatic complexity of 2
|
||||
fn barrr() { //~ ERROR: the function has a cyclomatic complexity of 2
|
||||
match 99 {
|
||||
0 => println!("hi"),
|
||||
1 => panic!("bla"),
|
||||
|
@ -198,7 +198,7 @@ fn barrr() { //~ ERROR: The function has a cyclomatic complexity of 2
|
|||
}
|
||||
|
||||
#[cyclomatic_complexity = "0"]
|
||||
fn barrr2() { //~ ERROR: The function has a cyclomatic complexity of 3
|
||||
fn barrr2() { //~ ERROR: the function has a cyclomatic complexity of 3
|
||||
match 99 {
|
||||
0 => println!("hi"),
|
||||
1 => panic!("bla"),
|
||||
|
@ -214,7 +214,7 @@ fn barrr2() { //~ ERROR: The function has a cyclomatic complexity of 3
|
|||
}
|
||||
|
||||
#[cyclomatic_complexity = "0"]
|
||||
fn barrrr() { //~ ERROR: The function has a cyclomatic complexity of 2
|
||||
fn barrrr() { //~ ERROR: the function has a cyclomatic complexity of 2
|
||||
match 99 {
|
||||
0 => println!("hi"),
|
||||
1 => println!("bla"),
|
||||
|
@ -224,7 +224,7 @@ fn barrrr() { //~ ERROR: The function has a cyclomatic complexity of 2
|
|||
}
|
||||
|
||||
#[cyclomatic_complexity = "0"]
|
||||
fn barrrr2() { //~ ERROR: The function has a cyclomatic complexity of 3
|
||||
fn barrrr2() { //~ ERROR: the function has a cyclomatic complexity of 3
|
||||
match 99 {
|
||||
0 => println!("hi"),
|
||||
1 => println!("bla"),
|
||||
|
@ -240,7 +240,7 @@ fn barrrr2() { //~ ERROR: The function has a cyclomatic complexity of 3
|
|||
}
|
||||
|
||||
#[cyclomatic_complexity = "0"]
|
||||
fn cake() { //~ ERROR: The function has a cyclomatic complexity of 2
|
||||
fn cake() { //~ ERROR: the function has a cyclomatic complexity of 2
|
||||
if 4 == 5 {
|
||||
println!("yea");
|
||||
} else {
|
||||
|
@ -251,7 +251,7 @@ fn cake() { //~ ERROR: The function has a cyclomatic complexity of 2
|
|||
|
||||
|
||||
#[cyclomatic_complexity = "0"]
|
||||
pub fn read_file(input_path: &str) -> String { //~ ERROR: The function has a cyclomatic complexity of 4
|
||||
pub fn read_file(input_path: &str) -> String { //~ ERROR: the function has a cyclomatic complexity of 4
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Write};
|
||||
use std::path::Path;
|
||||
|
@ -282,7 +282,7 @@ pub fn read_file(input_path: &str) -> String { //~ ERROR: The function has a cyc
|
|||
enum Void {}
|
||||
|
||||
#[cyclomatic_complexity = "0"]
|
||||
fn void(void: Void) { //~ ERROR: The function has a cyclomatic complexity of 1
|
||||
fn void(void: Void) { //~ ERROR: the function has a cyclomatic complexity of 1
|
||||
if true {
|
||||
match void {
|
||||
}
|
||||
|
|
|
@ -5,12 +5,12 @@ use std::fs::OpenOptions;
|
|||
#[allow(unused_must_use)]
|
||||
#[deny(nonsensical_open_options)]
|
||||
fn main() {
|
||||
OpenOptions::new().read(true).truncate(true).open("foo.txt"); //~ERROR File opened with "truncate" and "read"
|
||||
OpenOptions::new().append(true).truncate(true).open("foo.txt"); //~ERROR File opened with "append" and "truncate"
|
||||
|
||||
OpenOptions::new().read(true).read(false).open("foo.txt"); //~ERROR The method "read" is called more than once
|
||||
OpenOptions::new().create(true).create(false).open("foo.txt"); //~ERROR The method "create" is called more than once
|
||||
OpenOptions::new().write(true).write(false).open("foo.txt"); //~ERROR The method "write" is called more than once
|
||||
OpenOptions::new().append(true).append(false).open("foo.txt"); //~ERROR The method "append" is called more than once
|
||||
OpenOptions::new().truncate(true).truncate(false).open("foo.txt"); //~ERROR The method "truncate" is called more than once
|
||||
OpenOptions::new().read(true).truncate(true).open("foo.txt"); //~ERROR file opened with "truncate" and "read"
|
||||
OpenOptions::new().append(true).truncate(true).open("foo.txt"); //~ERROR file opened with "append" and "truncate"
|
||||
|
||||
OpenOptions::new().read(true).read(false).open("foo.txt"); //~ERROR the method "read" is called more than once
|
||||
OpenOptions::new().create(true).create(false).open("foo.txt"); //~ERROR the method "create" is called more than once
|
||||
OpenOptions::new().write(true).write(false).open("foo.txt"); //~ERROR the method "write" is called more than once
|
||||
OpenOptions::new().append(true).append(false).open("foo.txt"); //~ERROR the method "append" is called more than once
|
||||
OpenOptions::new().truncate(true).truncate(false).open("foo.txt"); //~ERROR the method "truncate" is called more than once
|
||||
}
|
||||
|
|
|
@ -12,12 +12,12 @@ const OPENING_PAREN : &'static str = "(";
|
|||
|
||||
fn main() {
|
||||
let pipe_in_wrong_position = Regex::new("|");
|
||||
//~^ERROR: Regex syntax error: empty alternate
|
||||
let wrong_char_ranice = Regex::new("[z-a]");
|
||||
//~^ERROR: Regex syntax error: invalid character class range
|
||||
|
||||
//~^ERROR: regex syntax error: empty alternate
|
||||
let wrong_char_ranice = Regex::new("[z-a]");
|
||||
//~^ERROR: regex syntax error: invalid character class range
|
||||
|
||||
let some_regex = Regex::new(OPENING_PAREN);
|
||||
//~^ERROR: Regex syntax error on position 0: unclosed
|
||||
//~^ERROR: regex syntax error on position 0: unclosed
|
||||
|
||||
let closing_paren = ")";
|
||||
let not_linted = Regex::new(closing_paren);
|
||||
|
|
Loading…
Reference in a new issue