@@ -90,7 +90,8 @@ fn process_file(text: &str, manifest: &Manifest) -> (Vec<LocalReport>, Vec<UseEd
9090
9191 match classify_use ( & use_item. tree , manifest) {
9292 UseShape :: Single { leaf } => {
93- if !referenced_in_body. contains ( & leaf. local_name ) {
93+ if is_alive ( & leaf. local_name , & referenced_in_body) {
94+ } else {
9495 reports. push ( LocalReport {
9596 start_line,
9697 ident : leaf. local_name . clone ( ) ,
@@ -109,7 +110,7 @@ fn process_file(text: &str, manifest: &Manifest) -> (Vec<LocalReport>, Vec<UseEd
109110 for m in & members {
110111 match & m. kind {
111112 MemberKind :: Engage { leaf } => {
112- if referenced_in_body . contains ( & leaf. local_name ) {
113+ if is_alive ( & leaf. local_name , & referenced_in_body ) {
113114 live_text_parts. push ( m. original_text . clone ( ) ) ;
114115 any_live_engage = true ;
115116 } else {
@@ -283,6 +284,19 @@ fn classify_use(tree: &UseTree, manifest: &Manifest) -> UseShape {
283284 }
284285}
285286
287+ fn is_alive ( local_name : & str , referenced_in_body : & BTreeSet < String > ) -> bool {
288+ if referenced_in_body. contains ( local_name) {
289+ return true ;
290+ }
291+
292+ let bytes = local_name. as_bytes ( ) ;
293+ if bytes. len ( ) >= 2 && bytes[ 0 ] == b'I' && bytes[ 1 ] . is_ascii_uppercase ( ) {
294+ return true ;
295+ }
296+
297+ false
298+ }
299+
286300fn leading_indent ( text : & str , start_line : usize ) -> String {
287301 let line = text. lines ( ) . nth ( start_line) . unwrap_or ( "" ) ;
288302 line. chars ( ) . take_while ( |c| c. is_whitespace ( ) && * c != '\n' ) . collect ( )
0 commit comments