From d7d9850c42ed7e49d0eebcedb3d9cc37d0309aa2 Mon Sep 17 00:00:00 2001 From: topecongiro Date: Sun, 18 Feb 2018 18:13:46 +0900 Subject: [PATCH] Do not inspect code for issues or todos when not required --- rustfmt-core/src/issues.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rustfmt-core/src/issues.rs b/rustfmt-core/src/issues.rs index 353f8349d2a..fc04c133197 100644 --- a/rustfmt-core/src/issues.rs +++ b/rustfmt-core/src/issues.rs @@ -93,9 +93,17 @@ pub fn new(report_todo: ReportTactic, report_fixme: ReportTactic) -> BadIssueSee } } + fn is_disabled(&self) -> bool { + !is_enabled(self.report_todo) && !is_enabled(self.report_fixme) + } + // Check whether or not the current char is conclusive evidence for an // unnumbered TO-DO or FIX-ME. pub fn inspect(&mut self, c: char) -> Option { + if self.is_disabled() { + return None; + } + match self.state { Seeking::Issue { todo_idx, -- 2.44.0