From 5c33c3e308a4fb6d93352115ec00e99d1920eff7 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Fri, 21 Jun 2019 12:08:26 -0400 Subject: [PATCH] Stop calling format! to check feature gate --- src/tools/tidy/src/features.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index ced30eb6d58a..da1387942976 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -186,9 +186,11 @@ fn test_find_attr_val() { } fn test_filen_gate(filen_underscore: &str, features: &mut Features) -> bool { - if filen_underscore.starts_with("feature_gate") { + let prefix = "feature_gate_"; + if filen_underscore.starts_with(prefix) { for (n, f) in features.iter_mut() { - if filen_underscore == format!("feature_gate_{}", n) { + // Equivalent to filen_underscore == format!("feature_gate_{}", n) + if &filen_underscore[prefix.len()..] == n { f.has_gate_test = true; return true; }