Bug 1481016 - Network, use inherent rust methods instead of deprecated std::ascii:AsciiExt ones, r=valentin
authorJeremy Lempereur <jeremy.lempereur@gmail.com>
Sat, 04 Aug 2018 20:24:59 +0200
changeset 485296 6ffbddf32df55a99e7e7a4c0b137bd15f6713007
parent 485295 d6f7f73cf5d8ae88f609b49ffb21bd76025e4f7d
child 485303 7a3737f257d51c78110bbab40017dbb593410518
child 485304 c7b907f13d38ca78ef72bfe094d23b51aaf5f8f8
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1481016
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1481016 - Network, use inherent rust methods instead of deprecated std::ascii:AsciiExt ones, r=valentin MozReview-Commit-ID: F1NGG0q6WdS
netwerk/base/rust-helper/src/lib.rs
--- a/netwerk/base/rust-helper/src/lib.rs
+++ b/netwerk/base/rust-helper/src/lib.rs
@@ -1,10 +1,8 @@
-use std::ascii::AsciiExt;
-
 extern crate nserror;
 use self::nserror::*;
 
 extern crate nsstring;
 use self::nsstring::nsACString;
 
 /// HTTP leading whitespace, defined in netwerk/protocol/http/nsHttp.h
 static HTTP_LWS: &'static [u8] = &[' ' as u8, '\t' as u8];
@@ -108,36 +106,36 @@ pub extern "C" fn rust_prepare_accept_la
 /// > At all times, language tags and their subtags, including private
 /// > use and extensions, are to be treated as case insensitive: there
 /// > exist conventions for the capitalization of some of the subtags,
 /// > but these MUST NOT be taken to carry meaning.
 ///
 /// So why is this code even here? See bug 1108183, I guess.
 fn canonicalize_language_tag(token: &mut [u8]) {
     for c in token.iter_mut() {
-        *c = AsciiExt::to_ascii_lowercase(c);
+        *c = c.to_ascii_lowercase();
     }
 
     let sub_tags = token.split_mut(|c| *c == ('-' as u8));
     for (i, sub_tag) in sub_tags.enumerate() {
         if i == 0 {
             // ISO 639-1 language code, like the "en" in "en-US"
             continue;
         }
 
         match sub_tag.len() {
             // Singleton tag, like "x" or "i". These signify a
             // non-standard language, so we stop capitalizing after
             // these.
             1 => break,
             // ISO 3166-1 Country code, like "US"
             2 => {
-                sub_tag[0] = AsciiExt::to_ascii_uppercase(&sub_tag[0]);
-                sub_tag[1] = AsciiExt::to_ascii_uppercase(&sub_tag[1]);
+                sub_tag[0] = sub_tag[0].to_ascii_uppercase();
+                sub_tag[1] = sub_tag[1].to_ascii_uppercase();
             },
             // ISO 15924 script code, like "Nkoo"
             4  => {
-                sub_tag[0] = AsciiExt::to_ascii_uppercase(&sub_tag[0]);
+                sub_tag[0] = sub_tag[0].to_ascii_uppercase();
             },
             _ => {},
         };
     }
 }