File tree 3 files changed +6
-13
lines changed
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> {
53
53
F : FnOnce ( & mut Parser ) -> Option < T > ,
54
54
{
55
55
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 ( ) )
60
57
} )
61
58
}
62
59
Original file line number Diff line number Diff line change @@ -1065,10 +1065,7 @@ impl<'a> Iterator for Ancestors<'a> {
1065
1065
1066
1066
fn next ( & mut self ) -> Option < Self :: Item > {
1067
1067
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) ;
1072
1069
next
1073
1070
}
1074
1071
}
Original file line number Diff line number Diff line change @@ -156,16 +156,15 @@ pub fn log_enabled() -> Option<PrintFormat> {
156
156
_ => return Some ( PrintFormat :: Full ) ,
157
157
}
158
158
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" {
161
161
None
162
162
} else if & x == "full" {
163
163
Some ( PrintFormat :: Full )
164
164
} else {
165
165
Some ( PrintFormat :: Short )
166
- } ,
167
- None => None ,
168
- } ;
166
+ }
167
+ ) ;
169
168
ENABLED . store ( match val {
170
169
Some ( v) => v as isize ,
171
170
None => 1 ,
You can’t perform that action at this time.
0 commit comments