mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:21 +00:00
Cheap cloneable LineIndex (#3896)
This commit is contained in:
parent
9209e57c5a
commit
76c47a9a43
10 changed files with 465 additions and 335 deletions
|
@ -58,6 +58,7 @@ impl Diagnostic {
|
|||
|
||||
/// Set the [`Fix`] used to fix the diagnostic, if the provided function returns `Ok`.
|
||||
/// Otherwise, log the error.
|
||||
#[inline]
|
||||
pub fn try_set_fix<T: Into<Fix>>(&mut self, func: impl FnOnce() -> Result<T>) {
|
||||
match func() {
|
||||
Ok(fix) => self.fix = fix.into(),
|
||||
|
@ -66,6 +67,7 @@ impl Diagnostic {
|
|||
}
|
||||
|
||||
/// Set the location of the diagnostic's parent node.
|
||||
#[inline]
|
||||
pub fn set_parent(&mut self, parent: Location) {
|
||||
self.parent = Some(parent);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue