@@ -341,15 +341,15 @@ fn walk_idl_file<'input>(
341341
342342 // Schema mode: optional `namespace`, optional `schema` declaration, plus
343343 // named type declarations.
344- if let Some ( ns_ctx) = ctx. namespaceDeclaration ( ) {
345- if let Some ( id_ctx) = ns_ctx. identifier ( ) {
346- let id = identifier_text ( & id_ctx ) ;
347- // In schema mode, `namespace foo.bar;` sets the enclosing namespace
348- // directly. Unlike protocol/record identifiers (where dots in the
349- // name imply a namespace prefix), here the entire identifier IS the
350- // namespace value.
351- * namespace = if id . is_empty ( ) { None } else { Some ( id ) } ;
352- }
344+ if let Some ( ns_ctx) = ctx. namespaceDeclaration ( )
345+ && let Some ( id_ctx) = ns_ctx. identifier ( )
346+ {
347+ let id = identifier_text ( & id_ctx ) ;
348+ // In schema mode, `namespace foo.bar;` sets the enclosing namespace
349+ // directly. Unlike protocol/record identifiers (where dots in the
350+ // name imply a namespace prefix), here the entire identifier IS the
351+ // namespace value.
352+ * namespace = if id . is_empty ( ) { None } else { Some ( id ) } ;
353353 }
354354
355355 // Collect imports (schema mode can also have them).
@@ -362,11 +362,11 @@ fn walk_idl_file<'input>(
362362 }
363363
364364 // The main schema declaration uses `schema <fullType>;`.
365- if let Some ( main_ctx) = ctx. mainSchemaDeclaration ( ) {
366- if let Some ( ft_ctx) = main_ctx. fullType ( ) {
367- let schema = walk_full_type ( & ft_ctx , token_stream , src , namespace ) ? ;
368- return Ok ( IdlFile :: SchemaFile ( schema ) ) ;
369- }
365+ if let Some ( main_ctx) = ctx. mainSchemaDeclaration ( )
366+ && let Some ( ft_ctx) = main_ctx. fullType ( )
367+ {
368+ let schema = walk_full_type ( & ft_ctx , token_stream , src , namespace ) ? ;
369+ return Ok ( IdlFile :: SchemaFile ( schema ) ) ;
370370 }
371371
372372 // If there are named schemas but no explicit `schema <type>;` declaration,
@@ -501,7 +501,7 @@ fn walk_record<'input>(
501501 let raw_identifier = identifier_text ( & name_ctx) ;
502502
503503 // Determine if this is a record or an error type.
504- let is_error = ctx. recordType . as_ref ( ) . map_or ( false , |tok| {
504+ let is_error = ctx. recordType . as_ref ( ) . is_some_and ( |tok| {
505505 tok. get_token_type ( ) == Idl_Error
506506 } ) ;
507507
@@ -1179,27 +1179,26 @@ fn unescape_java(s: &str) -> String {
11791179 result. push_str ( & hex) ;
11801180 }
11811181 }
1182- Some ( c2) if c2 >= '0' && c2 <= '7' => {
1182+ Some ( c2) if ( '0' ..= '7' ) . contains ( & c2 ) => {
11831183 // Octal escape: 1-3 octal digits. The grammar allows:
11841184 // OctDigit OctDigit? (1-2 digits, any octal)
11851185 // [0-3] OctDigit OctDigit (3 digits, first must be 0-3)
11861186 // This means a 3-digit sequence is only valid if the first
11871187 // digit is 0-3 (keeping the value <= \377 = 255).
11881188 let mut octal = String :: new ( ) ;
11891189 octal. push ( c2) ;
1190- if let Some ( & next) = chars. peek ( ) {
1191- if next >= '0' && next <= '7' {
1192- octal. push ( next) ;
1190+ if let Some ( & next) = chars. peek ( )
1191+ && ( '0' ..='7' ) . contains ( & next)
1192+ {
1193+ octal. push ( next) ;
1194+ chars. next ( ) ;
1195+ // Only consume a third digit if the first was 0-3.
1196+ if c2 <= '3'
1197+ && let Some ( & next2) = chars. peek ( )
1198+ && ( '0' ..='7' ) . contains ( & next2)
1199+ {
1200+ octal. push ( next2) ;
11931201 chars. next ( ) ;
1194- // Only consume a third digit if the first was 0-3.
1195- if c2 <= '3' {
1196- if let Some ( & next2) = chars. peek ( ) {
1197- if next2 >= '0' && next2 <= '7' {
1198- octal. push ( next2) ;
1199- chars. next ( ) ;
1200- }
1201- }
1202- }
12031202 }
12041203 }
12051204 if let Ok ( val) = u32:: from_str_radix ( & octal, 8 ) {
0 commit comments