Update style.rs for new Rustfmt style
This commit is contained in:
parent
9d393107c6
commit
6c7f2a065d
|
@ -125,7 +125,8 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
|
|||
if line.len() > 80 {
|
||||
err.error(path, i, "line longer than 80 chars");
|
||||
}
|
||||
if line.contains("#[cfg(") && !line.contains(" if ")
|
||||
// This doesn't work any more due to rustfmt changes
|
||||
/*if line.contains("#[cfg(") && !line.contains(" if ")
|
||||
&& !(line.contains("target_endian") ||
|
||||
line.contains("target_arch"))
|
||||
{
|
||||
|
@ -133,11 +134,12 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
|
|||
err.error(path, i, "use cfg_if! and submodules \
|
||||
instead of #[cfg]");
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if line.contains("#[derive(") && (line.contains("Copy") || line.contains("Clone")) {
|
||||
err.error(path, i, "impl ::Copy and ::Clone manually");
|
||||
}
|
||||
|
||||
let orig_line = line;
|
||||
let line = line.trim_start();
|
||||
let is_pub = line.starts_with("pub ");
|
||||
let line = if is_pub {&line[4..]} else {line};
|
||||
|
@ -161,7 +163,7 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
|
|||
} else if line.starts_with("f! {") {
|
||||
f_macros += 1;
|
||||
State::FunctionDefinitions
|
||||
} else if line.starts_with("extern ") {
|
||||
} else if line.starts_with("extern ") && !orig_line.starts_with(" ") {
|
||||
State::Functions
|
||||
} else if line.starts_with("mod ") {
|
||||
State::Modules
|
||||
|
|
Loading…
Reference in New Issue