From 6c7f2a065d1cfd64306cee7d990e2025717c678b Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Mon, 1 Feb 2021 22:53:00 +0000 Subject: [PATCH] Update style.rs for new Rustfmt style --- ci/style.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ci/style.rs b/ci/style.rs index 79574eb44e18d..b0b6d124f4b9c 100644 --- a/ci/style.rs +++ b/ci/style.rs @@ -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