diff options
author | kingdido999 <kingdido999@gmail.com> | 2018-08-31 08:19:22 +0800 |
---|---|---|
committer | kingdido999 <kingdido999@gmail.com> | 2018-08-31 08:19:22 +0800 |
commit | e4cd04399e436fad9c5239d76332d0b526c38f91 (patch) | |
tree | ae9d77904d8c1764ad450cc3e9f91339c583e365 /components/compositing/build.rs | |
parent | 1ee3deea274eeda9a31af3ccd3a9bacf19603ce8 (diff) | |
download | servo-e4cd04399e436fad9c5239d76332d0b526c38f91.tar.gz servo-e4cd04399e436fad9c5239d76332d0b526c38f91.zip |
Format component compositing #21373
Diffstat (limited to 'components/compositing/build.rs')
-rw-r--r-- | components/compositing/build.rs | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/components/compositing/build.rs b/components/compositing/build.rs index db081f795ad..8a13f9632d7 100644 --- a/components/compositing/build.rs +++ b/components/compositing/build.rs @@ -10,24 +10,33 @@ use std::io::{Read, Write}; use std::path::Path; fn main() { - let lockfile_path = Path::new(&env::var("CARGO_MANIFEST_DIR").unwrap()).join("..").join("..").join("Cargo.lock"); - let revision_file_path = Path::new(&env::var_os("OUT_DIR").unwrap()).join("webrender_revision.rs"); + let lockfile_path = Path::new(&env::var("CARGO_MANIFEST_DIR").unwrap()) + .join("..") + .join("..") + .join("Cargo.lock"); + let revision_file_path = + Path::new(&env::var_os("OUT_DIR").unwrap()).join("webrender_revision.rs"); let mut lockfile = String::new(); - File::open(lockfile_path).expect("Cannot open lockfile") + File::open(lockfile_path) + .expect("Cannot open lockfile") .read_to_string(&mut lockfile) .expect("Failed to read lockfile"); match toml::from_str::<toml::value::Table>(&lockfile) { Ok(result) => { - let packages = result.get("package").expect("Cargo lockfile should contain package list"); + let packages = result + .get("package") + .expect("Cargo lockfile should contain package list"); match *packages { toml::Value::Array(ref arr) => { let source = arr .iter() - .find(|pkg| pkg.get("name").and_then(|name| name.as_str()).unwrap_or("") == "webrender") - .and_then(|pkg| pkg.get("source").and_then(|source| source.as_str())) + .find(|pkg| { + pkg.get("name").and_then(|name| name.as_str()).unwrap_or("") == + "webrender" + }).and_then(|pkg| pkg.get("source").and_then(|source| source.as_str())) .unwrap_or("unknown"); let parsed: Vec<&str> = source.split("#").collect(); @@ -36,9 +45,9 @@ fn main() { let mut revision_module_file = File::create(&revision_file_path).unwrap(); write!(&mut revision_module_file, "{}", format!("\"{}\"", revision)).unwrap(); }, - _ => panic!("Cannot find package definitions in lockfile") + _ => panic!("Cannot find package definitions in lockfile"), } }, - Err(e) => panic!(e) + Err(e) => panic!(e), } } |