diff options
author | Pyfisch <pyfisch@gmail.com> | 2018-11-03 15:28:48 +0100 |
---|---|---|
committer | Pyfisch <pyfisch@gmail.com> | 2018-11-03 15:29:01 +0100 |
commit | 2481ad25f82b1a5a005f3ecbf9ba4d2a88060b5b (patch) | |
tree | e6d28676c8bd0a4a842ec0ee6e953ce2d3aa1b9d /components/net/data_loader.rs | |
parent | ba1ed11ced078686febc78b580773e8e93789b4d (diff) | |
download | servo-2481ad25f82b1a5a005f3ecbf9ba4d2a88060b5b.tar.gz servo-2481ad25f82b1a5a005f3ecbf9ba4d2a88060b5b.zip |
Rustfmt net crate
Diffstat (limited to 'components/net/data_loader.rs')
-rw-r--r-- | components/net/data_loader.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/components/net/data_loader.rs b/components/net/data_loader.rs index 16ffb75a323..3cd282bb1ed 100644 --- a/components/net/data_loader.rs +++ b/components/net/data_loader.rs @@ -18,7 +18,9 @@ pub type DecodeData = (Mime, Vec<u8>); pub fn decode(url: &ServoUrl) -> Result<DecodeData, DecodeError> { assert_eq!(url.scheme(), "data"); // Split out content type and data. - let parts: Vec<&str> = url[Position::BeforePath..Position::AfterQuery].splitn(2, ',').collect(); + let parts: Vec<&str> = url[Position::BeforePath..Position::AfterQuery] + .splitn(2, ',') + .collect(); if parts.len() != 2 { return Err(DecodeError::InvalidDataUri); } @@ -36,15 +38,18 @@ pub fn decode(url: &ServoUrl) -> Result<DecodeData, DecodeError> { ct_str.to_owned() }; - let content_type = ct_str.parse().unwrap_or_else(|_| { - "text/plain; charset=US-ASCII".parse().unwrap() - }); + let content_type = ct_str + .parse() + .unwrap_or_else(|_| "text/plain; charset=US-ASCII".parse().unwrap()); let mut bytes = percent_decode(parts[1].as_bytes()).collect::<Vec<_>>(); if is_base64 { // FIXME(#2909): It’s unclear what to do with non-alphabet characters, // but Acid 3 apparently depends on spaces being ignored. - bytes = bytes.into_iter().filter(|&b| b != b' ').collect::<Vec<u8>>(); + bytes = bytes + .into_iter() + .filter(|&b| b != b' ') + .collect::<Vec<u8>>(); match base64::decode(&bytes) { Err(..) => return Err(DecodeError::NonBase64DataUri), Ok(data) => bytes = data, |