File tree 1 file changed +3
-8
lines changed
1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -392,8 +392,8 @@ impl CodeMap {
392
392
return None ;
393
393
}
394
394
395
- // ensure these follow the expected order
396
- if sp_lhs. lo <= sp_rhs. lo {
395
+ // ensure these follow the expected order and we don't overlap
396
+ if ( sp_lhs. lo <= sp_rhs. lo ) && ( sp_lhs . hi <= sp_rhs . lo ) {
397
397
Some ( Span {
398
398
lo : cmp:: min ( sp_lhs. lo , sp_rhs. lo ) ,
399
399
hi : cmp:: max ( sp_lhs. hi , sp_rhs. hi ) ,
@@ -1146,12 +1146,7 @@ mod tests {
1146
1146
let span1 = span_from_selection ( inputtext, selection1) ;
1147
1147
let span2 = span_from_selection ( inputtext, selection2) ;
1148
1148
1149
- if let Some ( _) = cm. merge_spans ( span1, span2) {
1150
- assert ! ( false ) ;
1151
- }
1152
- else {
1153
- assert ! ( true ) ;
1154
- }
1149
+ assert ! ( cm. merge_spans( span1, span2) . is_none( ) ) ;
1155
1150
}
1156
1151
1157
1152
/// Returns the span corresponding to the `n`th occurrence of
You can’t perform that action at this time.
0 commit comments