Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
  • Loading branch information
ggwpez committed Oct 3, 2023
1 parent 8b31e1f commit a2125ce
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
16 changes: 9 additions & 7 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,14 @@ pub fn compare_commits(
compare_files(olds, news, params, filter)
}

pub fn git_checkout(path: &Path, refname: &str, should_pull: bool, force: bool) -> Result<(), String> {
pub fn git_checkout(
path: &Path,
refname: &str,
should_pull: bool,
force: bool,
) -> Result<(), String> {
if force {
return git_reset(path, refname, should_pull);
return git_reset(path, refname, should_pull)
}

log::info!("Checking out {}", refname);
Expand Down Expand Up @@ -248,12 +253,9 @@ pub fn git_pull(path: &Path, refname: &str) -> Result<(), String> {
.current_dir(path)
.output()
.map_err(|e| format!("Failed to fetch branch: {:?}", &e))?;

if !output.status.success() {
return Err(format!(
"Failed to fetch branch: {}",
String::from_utf8_lossy(&output.stderr),
))
return Err(format!("Failed to fetch branch: {}", String::from_utf8_lossy(&output.stderr),))
}

Ok(())
Expand Down
3 changes: 2 additions & 1 deletion web/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@ fn do_compare_cached(
args.git_pull.unwrap_or(true),
);

let params = CompareParams { method, ignore_errors, unit, git_pull, offline: false, git_force: true };
let params =
CompareParams { method, ignore_errors, unit, git_pull, offline: false, git_force: true };
let filter = FilterParams {
threshold: args.threshold as f64,
change: None,
Expand Down
8 changes: 4 additions & 4 deletions web/tests/swc_web_works.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ fn subweight_web_url_works() {
for _ in 0..20 {
std::thread::sleep(std::time::Duration::from_millis(100));

let Ok(resp) = reqwest::blocking::get("http://127.0.0.1:8080/compare").map(|r| r.text().unwrap()) else {
let Ok(resp) =
reqwest::blocking::get("http://127.0.0.1:8080/compare").map(|r| r.text().unwrap())
else {
continue
};

Expand Down Expand Up @@ -84,9 +86,7 @@ fn subweight_web_compare_works() {

let url = "http://127.0.0.1:8080/compare?old=v0.9.19&new=v0.9.20&repo=polkadot&threshold=10&unit=weight&path_pattern=runtime/polkadot/src/weights/*.rs&method=base&ignore_errors=false&git_pull=false";

let Ok(resp) = reqwest::blocking::get(url).map(|r| r.text().unwrap()) else {
continue
};
let Ok(resp) = reqwest::blocking::get(url).map(|r| r.text().unwrap()) else { continue };

// Some magic numbers: utility::batch_all and staking::validate old equations
if !resp.contains("12.68M + 4.41M * c + READ + WRITE") ||
Expand Down

0 comments on commit a2125ce

Please sign in to comment.