File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -48,17 +48,13 @@ lazy_static! {
48
48
}
49
49
50
50
fn encoding_from_name ( encoding_name : & str ) -> Option < & ( dyn encoding:: Encoding + Send + Sync ) > {
51
- match encoding:: label:: encoding_from_whatwg_label ( & encoding_name) {
52
- Some ( e) => return Some ( e) ,
53
- None => {
54
- if let Some ( cap) = CP_NUMBER . captures ( & encoding_name) {
55
- return encoding:: label:: encoding_from_windows_code_page (
56
- str:: parse ( cap. get ( 1 ) . unwrap ( ) . as_str ( ) ) . unwrap ( ) ,
57
- ) ;
58
- } else {
59
- return None ;
60
- }
61
- }
51
+ match encoding:: label:: encoding_from_whatwg_label ( encoding_name) {
52
+ s @ Some ( _) => s,
53
+ None => CP_NUMBER . captures ( encoding_name) . and_then ( |cap| {
54
+ encoding:: label:: encoding_from_windows_code_page (
55
+ str:: parse ( cap. get ( 1 ) . unwrap ( ) . as_str ( ) ) . unwrap ( ) ,
56
+ )
57
+ } ) ,
62
58
}
63
59
}
64
60
You can’t perform that action at this time.
0 commit comments