Cheap cloneable LineIndex (#3896)

This commit is contained in:
Micha Reiser 2023-04-11 09:33:40 +02:00 committed by GitHub
parent 9209e57c5a
commit 76c47a9a43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 465 additions and 335 deletions

View file

@ -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);
}