Bug 1499359: Apply rustfmt on build_gecko.rs; r=emilio
authorBenjamin Bouvier <benj@benj.me>
Tue, 16 Oct 2018 15:18:26 +0200
changeset 499967 000359cfa7019e7d2edc8fe3d442a5643a81ef61
parent 499966 45de3b6b39960fc7a02dc804915718c60ac52e13
child 499991 af27cdf736f592782bb9f6d0a0bff62222a55e3e
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1499359
milestone64.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 1499359: Apply rustfmt on build_gecko.rs; r=emilio
servo/components/style/build_gecko.rs
--- a/servo/components/style/build_gecko.rs
+++ b/servo/components/style/build_gecko.rs
@@ -255,18 +255,17 @@ mod bindings {
             .unwrap()
             .write_all(&bytes)
             .expect("Unable to write output");
     }
 
     fn get_types(filename: &str, macro_pat: &str) -> Vec<(String, String)> {
         // Read the file
         let path = DISTDIR_PATH.join("include/mozilla/").join(filename);
-        let mut list_file = File::open(path)
-            .expect(&format!("Unable to open {}", filename));
+        let mut list_file = File::open(path).expect(&format!("Unable to open {}", filename));
         let mut content = String::new();
         list_file
             .read_to_string(&mut content)
             .expect(&format!("Failed to read {}", filename));
         // Remove comments
         let block_comment_re = Regex::new(r#"(?s)/\*.*?\*/"#).unwrap();
         let line_comment_re = Regex::new(r#"//.*"#).unwrap();
         let content = block_comment_re.replace_all(&content, "");
@@ -274,34 +273,29 @@ mod bindings {
         // Extract the list
         let re_string = format!(r#"^({})\(.+,\s*(\w+)\)$"#, macro_pat);
         let re = Regex::new(&re_string).unwrap();
         content
             .lines()
             .map(|line| line.trim())
             .filter(|line| !line.is_empty())
             .map(|line| {
-                let captures = re.captures(&line)
-                    .expect(&format!(
-                        "Unrecognized line in {}: '{}'",
-                        filename,
-                        line
-                    ));
+                let captures = re
+                    .captures(&line)
+                    .expect(&format!("Unrecognized line in {}: '{}'", filename, line));
                 let macro_name = captures.get(1).unwrap().as_str().to_string();
                 let type_name = captures.get(2).unwrap().as_str().to_string();
                 (macro_name, type_name)
             }).collect()
     }
 
     fn get_borrowed_types() -> Vec<(bool, String)> {
         get_types("BorrowedTypeList.h", "GECKO_BORROWED_TYPE(?:_MUT)?")
             .into_iter()
-            .map(|(macro_name, type_name)| {
-                (macro_name.ends_with("MUT"), type_name)
-            })
+            .map(|(macro_name, type_name)| (macro_name.ends_with("MUT"), type_name))
             .collect()
     }
 
     fn get_arc_types() -> Vec<String> {
         get_types("ServoArcTypeList.h", "SERVO_ARC_TYPE")
             .into_iter()
             .map(|(_, type_name)| type_name)
             .collect()
@@ -530,21 +524,27 @@ mod bindings {
                     "pub type {0}Strong = ::gecko_bindings::sugar::ownership::Strong<{0}>;",
                     ty
                 )).borrowed_type(ty)
                 .zero_size_type(ty, &structs_types);
         }
         for ty in get_boxed_types().iter() {
             builder = builder
                 .blacklist_type(format!("{}Owned", ty))
-                .raw_line(format!("pub type {0}Owned = ::gecko_bindings::sugar::ownership::Owned<{0}>;", ty))
-                .blacklist_type(format!("{}OwnedOrNull", ty))
-                .raw_line(format!(concat!("pub type {0}OwnedOrNull = ",
-                                          "::gecko_bindings::sugar::ownership::OwnedOrNull<{0}>;"), ty))
-                .mutable_borrowed_type(ty)
+                .raw_line(format!(
+                    "pub type {0}Owned = ::gecko_bindings::sugar::ownership::Owned<{0}>;",
+                    ty
+                )).blacklist_type(format!("{}OwnedOrNull", ty))
+                .raw_line(format!(
+                    concat!(
+                        "pub type {0}OwnedOrNull = ",
+                        "::gecko_bindings::sugar::ownership::OwnedOrNull<{0}>;"
+                    ),
+                    ty
+                )).mutable_borrowed_type(ty)
                 .zero_size_type(ty, &structs_types);
         }
         write_binding_file(builder, BINDINGS_FILE, &fixups);
     }
 
     fn generate_atoms() {
         let script = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap())
             .join("gecko")