File tree Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Expand file tree Collapse file tree 1 file changed +2
-11
lines changed Original file line number Diff line number Diff line change @@ -878,17 +878,8 @@ impl SourceMap {
878878
879879 // Returns the index of the `SourceFile` (in `self.files`) that contains `pos`.
880880 pub fn lookup_source_file_idx ( & self , pos : BytePos ) -> usize {
881- let files = self . files . borrow ( ) ;
882- let files = & files. source_files ;
883- let count = files. len ( ) ;
884-
885- // (p - 1) below will not underflow, this follows previous implementation's assumption.
886- assert ! ( count >= 1 ) ;
887- let ret = files. binary_search_by_key ( & pos, |key| key. start_pos ) . unwrap_or_else ( |p| p - 1 ) ;
888-
889- assert ! ( ret < count, "position {} does not resolve to a source location" , pos. to_usize( ) ) ;
890-
891- return ret;
881+ self . files . borrow ( ) . source_files . binary_search_by_key ( & pos, |key| key. start_pos )
882+ . unwrap_or_else ( |p| p - 1 )
892883 }
893884
894885 pub fn count_lines ( & self ) -> usize {
You can’t perform that action at this time.
0 commit comments