diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-11-16 21:58:58 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-11-16 21:58:58 +0000 |
| commit | 94470f4efd2ec0786dd1f201e9ea84651b4bb0d0 (patch) | |
| tree | 1bcf415fa3d0bedc9b223162446ab9653c8f5bec /compiler/rustc_errors | |
| parent | e702534763599db252f2ca308739ec340d0933de (diff) | |
| download | rust-94470f4efd2ec0786dd1f201e9ea84651b4bb0d0.tar.gz rust-94470f4efd2ec0786dd1f201e9ea84651b4bb0d0.zip | |
Use `as_deref` in compiler (but only where it makes sense)
Diffstat (limited to 'compiler/rustc_errors')
| -rw-r--r-- | compiler/rustc_errors/src/emitter.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 55c7997a513..d5b595feca9 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -248,7 +248,7 @@ pub trait Emitter: Translate { fluent_args: &FluentArgs<'_>, ) -> (MultiSpan, &'a [CodeSuggestion]) { let mut primary_span = diag.span.clone(); - let suggestions = diag.suggestions.as_ref().map_or(&[][..], |suggestions| &suggestions[..]); + let suggestions = diag.suggestions.as_deref().unwrap_or(&[]); if let Some((sugg, rest)) = suggestions.split_first() { let msg = self.translate_message(&sugg.msg, fluent_args); if rest.is_empty() && |
