File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
crates/ruff_db/src/diagnostic Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -501,13 +501,18 @@ impl Diagnostic {
501501
502502 /// Returns the ordering of diagnostics based on the start of their ranges, if they have any.
503503 ///
504- /// Panics if either diagnostic has no primary span, if the span has no range, or if its file is
505- /// not a `SourceFile`.
504+ /// Panics if either diagnostic has no primary span, or if its file is not a `SourceFile`.
506505 pub fn ruff_start_ordering ( & self , other : & Self ) -> std:: cmp:: Ordering {
507- ( self . expect_ruff_source_file ( ) , self . expect_range ( ) . start ( ) ) . cmp ( & (
506+ let a = (
507+ self . expect_ruff_source_file ( ) ,
508+ self . range ( ) . map ( |r| r. start ( ) ) ,
509+ ) ;
510+ let b = (
508511 other. expect_ruff_source_file ( ) ,
509- other. expect_range ( ) . start ( ) ,
510- ) )
512+ other. range ( ) . map ( |r| r. start ( ) ) ,
513+ ) ;
514+
515+ a. cmp ( & b)
511516 }
512517}
513518
You can’t perform that action at this time.
0 commit comments