File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -257,17 +257,14 @@ impl DbError {
257
257
let mut before_str = before[ before. len ( ) . saturating_sub ( 2 ) ..] . join ( "\n " ) ;
258
258
before_str. push_str ( after. first ( ) . copied ( ) . unwrap_or_default ( ) ) ;
259
259
260
- let after_str = after. get ( 1 ) . copied ( ) . unwrap_or_default ( ) ;
260
+ let indent = before. last ( ) . copied ( ) . unwrap_or_default ( ) . chars ( ) . count ( ) ;
261
+ let mut out = format ! ( "{before_str}\n {:width$}^" , "" , width = indent) ;
261
262
262
- let indent = before. last ( ) . copied ( ) . unwrap_or_default ( ) . len ( ) ;
263
+ if let Some ( after_str) = after. get ( 1 ) . copied ( ) {
264
+ out = format ! ( "{out}\n {after_str}" )
265
+ }
263
266
264
- Some ( format ! (
265
- "{before_str}\n
266
- {:width$}^
267
- {after_str}" ,
268
- "" ,
269
- width = indent
270
- ) )
267
+ Some ( out)
271
268
}
272
269
273
270
/// An indication of the context in which the error occurred.
You can’t perform that action at this time.
0 commit comments