From 7ef78bdef7c5934564b8315a9faefdff8d70624b Mon Sep 17 00:00:00 2001 From: Dhruv Manilawala Date: Wed, 26 Jun 2024 17:17:56 +0530 Subject: [PATCH] Code review changes --- crates/ruff/src/printer.rs | 2 +- crates/ruff_linter/src/message/github.rs | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/crates/ruff/src/printer.rs b/crates/ruff/src/printer.rs index f7403566ba6a0c..588b9e179a6869 100644 --- a/crates/ruff/src/printer.rs +++ b/crates/ruff/src/printer.rs @@ -80,7 +80,7 @@ impl Serialize for SerializeMessageKindAsTitle { impl Display for SerializeMessageKindAsTitle { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.0.as_str()) + f.write_str(self.0.as_str()) } } diff --git a/crates/ruff_linter/src/message/github.rs b/crates/ruff_linter/src/message/github.rs index 972e02475813eb..9fd0a5ee6b912a 100644 --- a/crates/ruff_linter/src/message/github.rs +++ b/crates/ruff_linter/src/message/github.rs @@ -49,15 +49,10 @@ impl Emitter for GithubEmitter { )?; if let Some(rule) = message.rule() { - writeln!( - writer, - " {code} {body}", - code = rule.noqa_code(), - body = message.body() - )?; - } else { - writeln!(writer, " {}", message.body())?; + write!(writer, " {}", rule.noqa_code())?; } + + writeln!(writer, " {}", message.body())?; } Ok(())