File tree 1 file changed +13
-14
lines changed
1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -138,13 +138,11 @@ impl<'a> DiagnosticConverter<'a> {
138
138
}
139
139
140
140
/// Provides the source string for the given `line` of `file`
141
- fn source_string ( file : Lrc < SourceFile > ,
142
- line : & Line ) -> String {
143
- let source_string = match file. get_line ( line. line_index - 1 ) {
144
- Some ( s) => s. clone ( ) ,
145
- None => return String :: new ( ) ,
146
- } ;
147
- source_string. to_string ( )
141
+ fn source_string (
142
+ file : Lrc < SourceFile > ,
143
+ line : & Line
144
+ ) -> String {
145
+ file. get_line ( line. line_index - 1 ) . map ( |a| a. to_string ( ) ) . unwrap_or ( String :: new ( ) )
148
146
}
149
147
150
148
/// Maps `Diagnostic::Level` to `snippet::AnnotationType`
@@ -184,13 +182,14 @@ impl AnnotateRsEmitterWriter {
184
182
self
185
183
}
186
184
187
- fn emit_messages_default ( & mut self ,
188
- level : & Level ,
189
- message : String ,
190
- code : & Option < DiagnosticId > ,
191
- msp : & MultiSpan ,
192
- children : & [ SubDiagnostic ] ,
193
- suggestions : & [ CodeSuggestion ]
185
+ fn emit_messages_default (
186
+ & mut self ,
187
+ level : & Level ,
188
+ message : String ,
189
+ code : & Option < DiagnosticId > ,
190
+ msp : & MultiSpan ,
191
+ children : & [ SubDiagnostic ] ,
192
+ suggestions : & [ CodeSuggestion ]
194
193
) {
195
194
let converter = DiagnosticConverter {
196
195
source_map : self . source_map . clone ( ) ,
You can’t perform that action at this time.
0 commit comments