mirror of https://github.com/astral-sh/ruff
Only log fix failures in debug
This commit is contained in:
parent
4678f7dafe
commit
8c876f319b
|
|
@ -1,9 +1,10 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use log::error;
|
use log::debug;
|
||||||
use ruff_text_size::{TextRange, TextSize};
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use ruff_text_size::{TextRange, TextSize};
|
||||||
|
|
||||||
use crate::{Edit, Fix};
|
use crate::{Edit, Fix};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
|
|
@ -60,11 +61,10 @@ impl Diagnostic {
|
||||||
/// Set the [`Fix`] used to fix the diagnostic, if the provided function returns `Ok`.
|
/// Set the [`Fix`] used to fix the diagnostic, if the provided function returns `Ok`.
|
||||||
/// Otherwise, log the error.
|
/// Otherwise, log the error.
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(deprecated)]
|
|
||||||
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 for {}: {}", self.kind.name, err),
|
Err(err) => debug!("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 for {}: {}", self.kind.name, err),
|
Err(err) => debug!("Failed to create fix for {}: {}", self.kind.name, err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue