Skip to content

Commit

Permalink
Update style.rs for new Rustfmt style
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Feb 1, 2021
1 parent 9d39310 commit 6c7f2a0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ci/style.rs
Expand Up @@ -125,19 +125,21 @@ 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"))
{
if state != State::Structs {
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};
Expand All @@ -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
Expand Down

0 comments on commit 6c7f2a0

Please sign in to comment.