File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -392,8 +392,8 @@ impl CodeMap {
392392 return None ;
393393 }
394394
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 ) {
397397 Some ( Span {
398398 lo : cmp:: min ( sp_lhs. lo , sp_rhs. lo ) ,
399399 hi : cmp:: max ( sp_lhs. hi , sp_rhs. hi ) ,
@@ -1146,12 +1146,7 @@ mod tests {
11461146 let span1 = span_from_selection ( inputtext, selection1) ;
11471147 let span2 = span_from_selection ( inputtext, selection2) ;
11481148
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( ) ) ;
11551150 }
11561151
11571152 /// Returns the span corresponding to the `n`th occurrence of
You can’t perform that action at this time.
0 commit comments