File tree Expand file tree Collapse file tree 3 files changed +6
-13
lines changed Expand file tree Collapse file tree 3 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -53,10 +53,7 @@ impl<'a> Parser<'a> {
5353 F : FnOnce ( & mut Parser ) -> Option < T > ,
5454 {
5555 self . read_atomically ( move |p| {
56- match cb ( p) {
57- Some ( x) => if p. is_eof ( ) { Some ( x) } else { None } ,
58- None => None ,
59- }
56+ cb ( p) . filter ( |_| p. is_eof ( ) )
6057 } )
6158 }
6259
Original file line number Diff line number Diff line change @@ -1065,10 +1065,7 @@ impl<'a> Iterator for Ancestors<'a> {
10651065
10661066 fn next ( & mut self ) -> Option < Self :: Item > {
10671067 let next = self . next ;
1068- self . next = match next {
1069- Some ( path) => path. parent ( ) ,
1070- None => None ,
1071- } ;
1068+ self . next = next. and_then ( Path :: parent) ;
10721069 next
10731070 }
10741071}
Original file line number Diff line number Diff line change @@ -156,16 +156,15 @@ pub fn log_enabled() -> Option<PrintFormat> {
156156 _ => return Some ( PrintFormat :: Full ) ,
157157 }
158158
159- let val = match env:: var_os ( "RUST_BACKTRACE" ) {
160- Some ( x ) => if & x == "0" {
159+ let val = env:: var_os ( "RUST_BACKTRACE" ) . and_then ( |x|
160+ if & x == "0" {
161161 None
162162 } else if & x == "full" {
163163 Some ( PrintFormat :: Full )
164164 } else {
165165 Some ( PrintFormat :: Short )
166- } ,
167- None => None ,
168- } ;
166+ }
167+ ) ;
169168 ENABLED . store ( match val {
170169 Some ( v) => v as isize ,
171170 None => 1 ,
You can’t perform that action at this time.
0 commit comments