File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -637,12 +637,11 @@ fn substitute_param<'a>(
637637 pat : & str ,
638638 t : Option < impl ToString > ,
639639) -> Cow < ' a , str > {
640- if let Some ( t) = t {
641- if typestr. find ( pat) . is_some ( ) {
640+ if let Some ( t) = t
641+ && typestr. find ( pat) . is_some ( ) {
642642 let t = t. to_string ( ) ;
643643 return typestr. replace ( pat, & t) . into ( ) ;
644644 }
645- }
646645 typestr
647646}
648647
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ pub(crate) fn add_location_comments(
6464 } ;
6565
6666 let path = & location. path ;
67- if path. len ( ) % 2 != 0 {
67+ if ! path. len ( ) . is_multiple_of ( 2 ) {
6868 return ;
6969 }
7070 let segments: Vec < _ > = path. chunks ( 2 ) . map ( |chunk| ( chunk[ 0 ] , chunk[ 1 ] ) ) . collect ( ) ;
Original file line number Diff line number Diff line change @@ -475,13 +475,12 @@ impl<'proto> TypeSpec<'proto> {
475475 /// generator options). Even though strings and bytes are also length-delimited, we don't need
476476 /// to cache them because calculating their lengths is trivial.
477477 pub ( crate ) fn generate_cache_type ( & self , ctx : & Context < ' proto > ) -> Option < TokenStream > {
478- if let TypeSpec :: Message ( tname) = self {
479- if ctx. params . cache_extern_types || !ctx. params . extern_paths . contains_key ( * tname) {
478+ if let TypeSpec :: Message ( tname) = self
479+ && ( ctx. params . cache_extern_types || !ctx. params . extern_paths . contains_key ( * tname) ) {
480480 let cache_name = ( * tname) . to_owned ( ) + "._Cache" ;
481481 let cache_type = ctx. resolve_type_name ( & cache_name) ;
482482 return Some ( cache_type) ;
483483 }
484- }
485484 None
486485 }
487486
You can’t perform that action at this time.
0 commit comments