@@ -88,7 +88,7 @@ struct Context {
8888impl Context {
8989 /// Returns true if the current function context is the constructor
9090 pub ( crate ) fn is_constructor_function ( & self ) -> bool {
91- self . function . as_ref ( ) . map_or ( false , |f| matches ! ( f. ty, FunctionTy :: Constructor ) )
91+ self . function . as_ref ( ) . is_some_and ( |f| matches ! ( f. ty, FunctionTy :: Constructor ) )
9292 }
9393}
9494
@@ -341,7 +341,7 @@ impl<'a, W: Write> Formatter<'a, W> {
341341 _ => stmt. loc ( ) . start ( ) ,
342342 } ;
343343
344- self . find_next_line ( start_from) . map_or ( false , |loc| loc >= end_at)
344+ self . find_next_line ( start_from) . is_some_and ( |loc| loc >= end_at)
345345 }
346346 }
347347 }
@@ -560,7 +560,7 @@ impl<'a, W: Write> Formatter<'a, W> {
560560 fn write_doc_block_line ( & mut self , comment : & CommentWithMetadata , line : & str ) -> Result < ( ) > {
561561 if line. trim ( ) . starts_with ( '*' ) {
562562 let line = line. trim ( ) . trim_start_matches ( '*' ) ;
563- let needs_space = line. chars ( ) . next ( ) . map_or ( false , |ch| !ch. is_whitespace ( ) ) ;
563+ let needs_space = line. chars ( ) . next ( ) . is_some_and ( |ch| !ch. is_whitespace ( ) ) ;
564564 write ! ( self . buf( ) , " *{}" , if needs_space { " " } else { "" } ) ?;
565565 self . write_comment_line ( comment, line) ?;
566566 self . write_whitespace_separator ( true ) ?;
@@ -1945,7 +1945,7 @@ impl<W: Write> Visitor for Formatter<'_, W> {
19451945 ) ?;
19461946
19471947 // EOF newline
1948- if self . last_char ( ) . map_or ( true , |char| char != '\n' ) {
1948+ if self . last_char ( ) != Some ( '\n' ) {
19491949 writeln ! ( self . buf( ) ) ?;
19501950 }
19511951
@@ -3259,7 +3259,7 @@ impl<W: Write> Visitor for Formatter<'_, W> {
32593259
32603260 // we can however check if the contract `is` the `base`, this however also does
32613261 // not cover all cases
3262- let is_contract_base = self . context . contract . as_ref ( ) . map_or ( false , |contract| {
3262+ let is_contract_base = self . context . contract . as_ref ( ) . is_some_and ( |contract| {
32633263 contract. base . iter ( ) . any ( |contract_base| {
32643264 contract_base
32653265 . name
@@ -3280,7 +3280,7 @@ impl<W: Write> Visitor for Formatter<'_, W> {
32803280 let mut base_or_modifier =
32813281 self . visit_to_chunk ( loc. start ( ) , Some ( loc. end ( ) ) , base) ?;
32823282 let is_lowercase =
3283- base_or_modifier. content . chars ( ) . next ( ) . map_or ( false , |c| c. is_lowercase ( ) ) ;
3283+ base_or_modifier. content . chars ( ) . next ( ) . is_some_and ( |c| c. is_lowercase ( ) ) ;
32843284 if is_lowercase && base_or_modifier. content . ends_with ( "()" ) {
32853285 base_or_modifier. content . truncate ( base_or_modifier. content . len ( ) - 2 ) ;
32863286 }
0 commit comments