Convert Option<&Lrc<T>> return types to Option<&T>.

It's simpler and more concise.
This commit is contained in:
Nicholas Nethercote
2024-10-07 11:03:52 +11:00
parent 55a22d2a63
commit 731469fee5
9 changed files with 28 additions and 30 deletions

View File

@@ -205,7 +205,7 @@ pub trait Emitter: Translate {
false
}
fn source_map(&self) -> Option<&Lrc<SourceMap>>;
fn source_map(&self) -> Option<&SourceMap>;
/// Formats the substitutions of the primary_span
///
@@ -481,8 +481,8 @@ pub trait Emitter: Translate {
}
impl Translate for HumanEmitter {
fn fluent_bundle(&self) -> Option<&Lrc<FluentBundle>> {
self.fluent_bundle.as_ref()
fn fluent_bundle(&self) -> Option<&FluentBundle> {
self.fluent_bundle.as_deref()
}
fn fallback_fluent_bundle(&self) -> &FluentBundle {
@@ -491,8 +491,8 @@ impl Translate for HumanEmitter {
}
impl Emitter for HumanEmitter {
fn source_map(&self) -> Option<&Lrc<SourceMap>> {
self.sm.as_ref()
fn source_map(&self) -> Option<&SourceMap> {
self.sm.as_deref()
}
fn emit_diagnostic(&mut self, mut diag: DiagInner) {
@@ -540,7 +540,7 @@ pub struct SilentEmitter {
}
impl Translate for SilentEmitter {
fn fluent_bundle(&self) -> Option<&Lrc<FluentBundle>> {
fn fluent_bundle(&self) -> Option<&FluentBundle> {
None
}
@@ -552,7 +552,7 @@ impl Translate for SilentEmitter {
}
impl Emitter for SilentEmitter {
fn source_map(&self) -> Option<&Lrc<SourceMap>> {
fn source_map(&self) -> Option<&SourceMap> {
None
}