Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1399610 commit d44bf32Copy full SHA for d44bf32
1 file changed
ruby/extractor/src/main.rs
@@ -48,17 +48,13 @@ lazy_static! {
48
}
49
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
+ match encoding::label::encoding_from_whatwg_label(encoding_name) {
+ s @ Some(_) => s,
+ None => CP_NUMBER.captures(encoding_name).and_then(|cap| {
+ encoding::label::encoding_from_windows_code_page(
+ str::parse(cap.get(1).unwrap().as_str()).unwrap(),
+ )
+ }),
62
63
64
0 commit comments