From 318653c427f2b463548cf6b344a26cc80e8ccba5 Mon Sep 17 00:00:00 2001 From: konstin Date: Tue, 9 May 2023 17:46:40 +0200 Subject: [PATCH] Write diagnostic name when failing to create fix (#4309) --- crates/ruff_diagnostics/src/diagnostic.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ruff_diagnostics/src/diagnostic.rs b/crates/ruff_diagnostics/src/diagnostic.rs index adab45e9e9..4c1569db27 100644 --- a/crates/ruff_diagnostics/src/diagnostic.rs +++ b/crates/ruff_diagnostics/src/diagnostic.rs @@ -65,7 +65,7 @@ impl Diagnostic { pub fn try_set_fix(&mut self, func: impl FnOnce() -> Result) { match func() { Ok(fix) => self.fix = Some(fix), - Err(err) => error!("Failed to create fix: {}", err), + Err(err) => error!("Failed to create fix for {}: {}", self.kind.name, err), } } @@ -76,7 +76,7 @@ impl Diagnostic { pub fn try_set_fix_from_edit(&mut self, func: impl FnOnce() -> Result) { match func() { Ok(edit) => self.fix = Some(Fix::unspecified(edit)), - Err(err) => error!("Failed to create fix: {}", err), + Err(err) => error!("Failed to create fix for {}: {}", self.kind.name, err), } }