Write diagnostic name when failing to create fix (#4309)

This commit is contained in:
konstin 2023-05-09 17:46:40 +02:00 committed by GitHub
parent f08fd5cbf0
commit 318653c427
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -65,7 +65,7 @@ impl Diagnostic {
pub fn try_set_fix(&mut self, func: impl FnOnce() -> Result<Fix>) { pub fn try_set_fix(&mut self, func: impl FnOnce() -> Result<Fix>) {
match func() { match func() {
Ok(fix) => self.fix = Some(fix), 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<Edit>) { pub fn try_set_fix_from_edit(&mut self, func: impl FnOnce() -> Result<Edit>) {
match func() { match func() {
Ok(edit) => self.fix = Some(Fix::unspecified(edit)), 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),
} }
} }