feat(oxc_diagnostic): impl DerefMut for OxcDiagnostic (#5474)

1. Impl `DerefMut` for `OxcDiagnositc` so downstream user could move `OxcDiagnostic` rather clone it,
40ae24d597/crates/rolldown_ecmascript/src/ecma_compiler.rs (L36-L48)
This commit is contained in:
IWANABETHATGUY 2024-09-05 08:55:52 +00:00
parent 9b984b31bd
commit 91b39c4b82

View file

@ -9,7 +9,7 @@ mod service;
use std::{
borrow::Cow,
fmt::{self, Display},
ops::Deref,
ops::{Deref, DerefMut},
};
pub use crate::{
@ -42,6 +42,12 @@ impl Deref for OxcDiagnostic {
}
}
impl DerefMut for OxcDiagnostic {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
#[derive(Debug, Default, Clone)]
pub struct OxcCode {
pub scope: Option<Cow<'static, str>>,