@@ -964,45 +964,40 @@ impl SourceMap {
964
964
965
965
/// Finds the width of the character, either before or after the end of provided span,
966
966
/// depending on the `forwards` parameter.
967
+ #[ instrument( skip( self , sp) ) ]
967
968
fn find_width_of_character_at_span ( & self , sp : Span , forwards : bool ) -> u32 {
968
969
let sp = sp. data ( ) ;
969
970
970
971
if sp. lo == sp. hi && !forwards {
971
- debug ! ( "find_width_of_character_at_span: early return empty span" ) ;
972
+ debug ! ( "early return empty span" ) ;
972
973
return 1 ;
973
974
}
974
975
975
976
let local_begin = self . lookup_byte_offset ( sp. lo ) ;
976
977
let local_end = self . lookup_byte_offset ( sp. hi ) ;
977
- debug ! (
978
- "find_width_of_character_at_span: local_begin=`{:?}`, local_end=`{:?}`" ,
979
- local_begin, local_end
980
- ) ;
978
+ debug ! ( "local_begin=`{:?}`, local_end=`{:?}`" , local_begin, local_end) ;
981
979
982
980
if local_begin. sf . start_pos != local_end. sf . start_pos {
983
- debug ! ( "find_width_of_character_at_span: begin and end are in different files" ) ;
981
+ debug ! ( "begin and end are in different files" ) ;
984
982
return 1 ;
985
983
}
986
984
987
985
let start_index = local_begin. pos . to_usize ( ) ;
988
986
let end_index = local_end. pos . to_usize ( ) ;
989
- debug ! (
990
- "find_width_of_character_at_span: start_index=`{:?}`, end_index=`{:?}`" ,
991
- start_index, end_index
992
- ) ;
987
+ debug ! ( "start_index=`{:?}`, end_index=`{:?}`" , start_index, end_index) ;
993
988
994
989
// Disregard indexes that are at the start or end of their spans, they can't fit bigger
995
990
// characters.
996
991
if ( !forwards && end_index == usize:: MIN ) || ( forwards && start_index == usize:: MAX ) {
997
- debug ! ( "find_width_of_character_at_span: start or end of span, cannot be multibyte" ) ;
992
+ debug ! ( "start or end of span, cannot be multibyte" ) ;
998
993
return 1 ;
999
994
}
1000
995
1001
996
let source_len = ( local_begin. sf . end_pos - local_begin. sf . start_pos ) . to_usize ( ) ;
1002
- debug ! ( "find_width_of_character_at_span: source_len=`{:?}`" , source_len) ;
997
+ debug ! ( "source_len=`{:?}`" , source_len) ;
1003
998
// Ensure indexes are also not malformed.
1004
999
if start_index > end_index || end_index > source_len - 1 {
1005
- debug ! ( "find_width_of_character_at_span: source indexes are malformed" ) ;
1000
+ debug ! ( "source indexes are malformed" ) ;
1006
1001
return 1 ;
1007
1002
}
1008
1003
@@ -1017,10 +1012,10 @@ impl SourceMap {
1017
1012
} else {
1018
1013
return 1 ;
1019
1014
} ;
1020
- debug ! ( "find_width_of_character_at_span: snippet=`{:?}`" , snippet) ;
1015
+ debug ! ( "snippet=`{:?}`" , snippet) ;
1021
1016
1022
1017
let mut target = if forwards { end_index + 1 } else { end_index - 1 } ;
1023
- debug ! ( "find_width_of_character_at_span: initial target=`{:?}`" , target) ;
1018
+ debug ! ( "initial target=`{:?}`" , target) ;
1024
1019
1025
1020
while !snippet. is_char_boundary ( target - start_index) && target < source_len {
1026
1021
target = if forwards {
@@ -1033,9 +1028,9 @@ impl SourceMap {
1033
1028
}
1034
1029
}
1035
1030
} ;
1036
- debug ! ( "find_width_of_character_at_span: target=`{:?}`" , target) ;
1031
+ debug ! ( "target=`{:?}`" , target) ;
1037
1032
}
1038
- debug ! ( "find_width_of_character_at_span: final target=`{:?}`" , target) ;
1033
+ debug ! ( "final target=`{:?}`" , target) ;
1039
1034
1040
1035
if forwards { ( target - end_index) as u32 } else { ( end_index - target) as u32 }
1041
1036
}
0 commit comments