Skip to content

Run cargo fmt #896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
with:
fetch-depth: 1

- name: Formatting check
run: cargo fmt --all -- --check

- name: Test and build
run: docker build -t rustc-perf .

Expand Down
13 changes: 8 additions & 5 deletions collector/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ use collector::command_output;
use database::{PatchName, QueryLabel};
use futures::stream::FuturesUnordered;
use futures::stream::StreamExt;
use std::{cmp, ffi::OsStr, path::Component};
use std::collections::HashMap;
use std::env;
use std::fmt;
use std::fs::{self, File};
use std::hash;
use std::io::Read;
use std::mem::ManuallyDrop;
use std::path::{Path, PathBuf};
use std::process::{self, Command};
use std::str;
use std::mem::ManuallyDrop;
use std::time::Duration;
use std::{cmp, ffi::OsStr, path::Component};
use tempfile::TempDir;
use tokio::runtime::Runtime;

Expand Down Expand Up @@ -61,7 +61,8 @@ fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> anyhow::Result<()>
fn touch(path: &Path) -> anyhow::Result<()> {
log::trace!("touching file {:?}", path);

filetime::set_file_mtime(path, filetime::FileTime::now()).with_context(|| format!("touching file {:?}", path))?;
filetime::set_file_mtime(path, filetime::FileTime::now())
.with_context(|| format!("touching file {:?}", path))?;

Ok(())
}
Expand Down Expand Up @@ -92,7 +93,8 @@ fn touch_all(path: &Path) -> anyhow::Result<()> {
// We also delete the cmake caches to avoid errors when moving directories around.
// This might be a bit slower but at least things build
if path.file_name() == Some(OsStr::new("CMakeCache.txt")) {
fs::remove_file(path).with_context(|| format!("deleting cmake caches in {:?}", path))?;
fs::remove_file(path)
.with_context(|| format!("deleting cmake caches in {:?}", path))?;
}

if is_valid(path) {
Expand Down Expand Up @@ -1152,7 +1154,8 @@ impl Benchmark {
let mut base_dot = base.to_path_buf();
base_dot.push(".");
let tmp_dir = TempDir::new()?;
Self::copy(&base_dot, tmp_dir.path()).with_context(|| format!("copying {} to tmp dir", self.name))?;
Self::copy(&base_dot, tmp_dir.path())
.with_context(|| format!("copying {} to tmp dir", self.name))?;
Ok(tmp_dir)
}

Expand Down
11 changes: 8 additions & 3 deletions collector/src/execute/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ fn record(
.context("git reset --hard")?;

if !status.success() && matches!(artifact, ArtifactId::Artifact(_)) {
log::warn!("git reset --hard {} failed - trying default branch", artifact);
log::warn!(
"git reset --hard {} failed - trying default branch",
artifact
);
status = Command::new("git")
.current_dir("rust")
.arg("reset")
Expand Down Expand Up @@ -168,7 +171,10 @@ fn checkout(artifact: &ArtifactId) -> anyhow::Result<()> {
.context("git fetch origin")?;

if !status.success() && matches!(artifact, ArtifactId::Artifact(_)) {
log::warn!("git fetch origin {} failed - trying default branch", artifact);
log::warn!(
"git fetch origin {} failed - trying default branch",
artifact
);
status = Command::new("git")
.current_dir("rust")
.arg("fetch")
Expand All @@ -178,7 +184,6 @@ fn checkout(artifact: &ArtifactId) -> anyhow::Result<()> {
.context("git fetch origin HEAD")?;
}
assert!(status.success(), "git fetch successful");

} else {
let status = Command::new("git")
.arg("clone")
Expand Down
9 changes: 5 additions & 4 deletions collector/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ pub fn run_command(cmd: &mut Command) -> anyhow::Result<()> {
pub fn robocopy(
from: &std::path::Path,
to: &std::path::Path,
extra_args: &[&dyn AsRef<std::ffi::OsStr>]
extra_args: &[&dyn AsRef<std::ffi::OsStr>],
) -> anyhow::Result<()> {
let mut cmd = Command::new("robocopy");
cmd.arg(from).arg(to).arg("/s").arg("/e");
Expand Down Expand Up @@ -219,7 +219,7 @@ pub fn command_output(cmd: &mut Command) -> anyhow::Result<process::Output> {
output.status,
String::from_utf8_lossy(&output.stderr),
String::from_utf8_lossy(&output.stdout)
));
));
}

Ok(output)
Expand All @@ -246,7 +246,8 @@ pub struct MasterCommit {
/// Note that this does not contain try commits today, so it should not be used
/// to validate hashes or expand them generally speaking. This may also change
/// in the future.
pub async fn master_commits() -> Result<Vec<MasterCommit>, Box<dyn std::error::Error + Sync + Send>> {
pub async fn master_commits() -> Result<Vec<MasterCommit>, Box<dyn std::error::Error + Sync + Send>>
{
let response = reqwest::get("https://triage.rust-lang.org/bors-commit-list").await?;
Ok(response.json().await?)
}
}
7 changes: 5 additions & 2 deletions collector/src/read2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ mod imp {
if v.capacity() == v.len() {
v.reserve(1);
}
slice::from_raw_parts_mut(v.as_mut_ptr().offset(v.len() as isize), v.capacity() - v.len())
slice::from_raw_parts_mut(
v.as_mut_ptr().offset(v.len() as isize),
v.capacity() - v.len(),
)
}
}
}
5 changes: 3 additions & 2 deletions site/src/self_profile/crox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ pub fn generate(pieces: super::Pieces, opt: Opt) -> anyhow::Result<Vec<u8>> {

let mut seq = serializer.serialize_seq(None)?;

let data = ProfilingData::from_buffers(pieces.string_data, pieces.string_index, pieces.events, None)
.map_err(|e| anyhow::format_err!("{:?}", e))?;
let data =
ProfilingData::from_buffers(pieces.string_data, pieces.string_index, pieces.events, None)
.map_err(|e| anyhow::format_err!("{:?}", e))?;

let thread_to_collapsed_thread =
generate_thread_to_collapsed_thread_mapping(opt.collapse_threads, &data);
Expand Down
7 changes: 5 additions & 2 deletions site/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1230,9 +1230,12 @@ impl UpdatingStatus {

// Returns previous state
fn set_updating(&self) -> bool {
match self.0.compare_exchange(false, true, AtomicOrdering::SeqCst, AtomicOrdering::SeqCst) {
match self
.0
.compare_exchange(false, true, AtomicOrdering::SeqCst, AtomicOrdering::SeqCst)
{
Ok(b) => b,
Err(b) => b
Err(b) => b,
}
}

Expand Down