Skip to content

Commit e4384f6

Browse files
committed
Run rustfmt
1 parent eeaa5d2 commit e4384f6

File tree

1 file changed

+36
-20
lines changed

1 file changed

+36
-20
lines changed

build.rs

+36-20
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,9 @@ mod sources {
393393
mod c_vendor {
394394
extern crate cc;
395395

396+
use sources;
396397
use std::env;
397398
use std::path::PathBuf;
398-
use sources;
399399

400400
/// Compile intrinsics from the compiler-rt C source code
401401
pub fn compile(llvm_target: &[&str]) {
@@ -464,9 +464,9 @@ mod c_system {
464464
use std::collections::HashMap;
465465
use std::env;
466466
use std::fs::File;
467+
use std::path::{Path, PathBuf};
467468
use std::process::{Command, Output};
468469
use std::str;
469-
use std::path::{Path, PathBuf};
470470

471471
use sources;
472472

@@ -492,24 +492,28 @@ mod c_system {
492492
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
493493
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
494494
let r = match target_arch.as_str() {
495-
"arm" => if target.ends_with("eabihf") && target_os != "windows" {
496-
"armhf"
497-
} else {
498-
"arm"
499-
},
500-
"x86" => if target_os == "android" {
501-
"i686"
502-
} else {
503-
"i386"
504-
},
495+
"arm" => {
496+
if target.ends_with("eabihf") && target_os != "windows" {
497+
"armhf"
498+
} else {
499+
"arm"
500+
}
501+
}
502+
"x86" => {
503+
if target_os == "android" {
504+
"i686"
505+
} else {
506+
"i386"
507+
}
508+
}
505509
_ => target_arch.as_str(),
506510
};
507511
r.to_string()
508512
}
509513

510514
fn find_library<I>(dirs: I, libname: &str) -> Result<PathBuf, Vec<String>>
511515
where
512-
I: Iterator<Item = PathBuf>
516+
I: Iterator<Item = PathBuf>,
513517
{
514518
let mut paths = Vec::new();
515519
for dir in dirs {
@@ -530,7 +534,11 @@ mod c_system {
530534
let compiler_rt_arch = get_arch_name_for_compiler_rtlib();
531535
let out_dir = env::var("OUT_DIR").unwrap();
532536

533-
if ALL_SUPPORTED_ARCHES.split(";").find(|x| *x == compiler_rt_arch) == None {
537+
if ALL_SUPPORTED_ARCHES
538+
.split(";")
539+
.find(|x| *x == compiler_rt_arch)
540+
== None
541+
{
534542
return;
535543
}
536544

@@ -559,12 +567,15 @@ mod c_system {
559567
Command::new(llvm_config).arg("--libdir"),
560568
);
561569
let libdir = str::from_utf8(&output.stdout).unwrap().trim_end();
562-
let paths = std::fs::read_dir(Path::new(libdir).join("clang")).unwrap().map(|e| {
563-
e.unwrap().path().join("lib").join(subpath)
564-
});
570+
let paths = std::fs::read_dir(Path::new(libdir).join("clang"))
571+
.unwrap()
572+
.map(|e| e.unwrap().path().join("lib").join(subpath));
565573
match find_library(paths, &libname) {
566574
Ok(p) => p,
567-
Err(paths) => panic!("failed to find llvm-config's compiler-rt: {}", paths.join(":")),
575+
Err(paths) => panic!(
576+
"failed to find llvm-config's compiler-rt: {}",
577+
paths.join(":")
578+
),
568579
}
569580
} else {
570581
panic!("neither CLANG nor LLVM_CONFIG could be read");
@@ -581,10 +592,15 @@ mod c_system {
581592
}
582593

583594
let sources = sources::get_sources(llvm_target);
584-
let mut new = ar::Builder::new(File::create(Path::new(&out_dir).join("libcompiler-rt.a")).unwrap());
595+
let mut new =
596+
ar::Builder::new(File::create(Path::new(&out_dir).join("libcompiler-rt.a")).unwrap());
585597
for (sym, _src) in sources.map.iter() {
586598
let &i = {
587-
let sym_ = if sym.starts_with("__") { &sym[2..] } else { &sym };
599+
let sym_ = if sym.starts_with("__") {
600+
&sym[2..]
601+
} else {
602+
&sym
603+
};
588604
match files.get(&format!("{}.c.o", sym_)) {
589605
Some(i) => i,
590606
None => match files.get(&format!("{}.S.o", sym_)) {

0 commit comments

Comments
 (0)