Skip to content

Commit 7076c93

Browse files
Merge pull request #896 from rylev/fmt
Run cargo fmt
2 parents 52a10d4 + a900b9b commit 7076c93

File tree

7 files changed

+37
-18
lines changed

7 files changed

+37
-18
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ jobs:
1818
with:
1919
fetch-depth: 1
2020

21+
- name: Formatting check
22+
run: cargo fmt --all -- --check
23+
2124
- name: Test and build
2225
run: docker build -t rustc-perf .
2326

collector/src/execute.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ use collector::command_output;
66
use database::{PatchName, QueryLabel};
77
use futures::stream::FuturesUnordered;
88
use futures::stream::StreamExt;
9-
use std::{cmp, ffi::OsStr, path::Component};
109
use std::collections::HashMap;
1110
use std::env;
1211
use std::fmt;
1312
use std::fs::{self, File};
1413
use std::hash;
1514
use std::io::Read;
15+
use std::mem::ManuallyDrop;
1616
use std::path::{Path, PathBuf};
1717
use std::process::{self, Command};
1818
use std::str;
19-
use std::mem::ManuallyDrop;
2019
use std::time::Duration;
20+
use std::{cmp, ffi::OsStr, path::Component};
2121
use tempfile::TempDir;
2222
use tokio::runtime::Runtime;
2323

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

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

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

98100
if is_valid(path) {
@@ -1152,7 +1154,8 @@ impl Benchmark {
11521154
let mut base_dot = base.to_path_buf();
11531155
base_dot.push(".");
11541156
let tmp_dir = TempDir::new()?;
1155-
Self::copy(&base_dot, tmp_dir.path()).with_context(|| format!("copying {} to tmp dir", self.name))?;
1157+
Self::copy(&base_dot, tmp_dir.path())
1158+
.with_context(|| format!("copying {} to tmp dir", self.name))?;
11561159
Ok(tmp_dir)
11571160
}
11581161

collector/src/execute/rustc.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ fn record(
4949
.context("git reset --hard")?;
5050

5151
if !status.success() && matches!(artifact, ArtifactId::Artifact(_)) {
52-
log::warn!("git reset --hard {} failed - trying default branch", artifact);
52+
log::warn!(
53+
"git reset --hard {} failed - trying default branch",
54+
artifact
55+
);
5356
status = Command::new("git")
5457
.current_dir("rust")
5558
.arg("reset")
@@ -168,7 +171,10 @@ fn checkout(artifact: &ArtifactId) -> anyhow::Result<()> {
168171
.context("git fetch origin")?;
169172

170173
if !status.success() && matches!(artifact, ArtifactId::Artifact(_)) {
171-
log::warn!("git fetch origin {} failed - trying default branch", artifact);
174+
log::warn!(
175+
"git fetch origin {} failed - trying default branch",
176+
artifact
177+
);
172178
status = Command::new("git")
173179
.current_dir("rust")
174180
.arg("fetch")
@@ -178,7 +184,6 @@ fn checkout(artifact: &ArtifactId) -> anyhow::Result<()> {
178184
.context("git fetch origin HEAD")?;
179185
}
180186
assert!(status.success(), "git fetch successful");
181-
182187
} else {
183188
let status = Command::new("git")
184189
.arg("clone")

collector/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn run_command(cmd: &mut Command) -> anyhow::Result<()> {
148148
pub fn robocopy(
149149
from: &std::path::Path,
150150
to: &std::path::Path,
151-
extra_args: &[&dyn AsRef<std::ffi::OsStr>]
151+
extra_args: &[&dyn AsRef<std::ffi::OsStr>],
152152
) -> anyhow::Result<()> {
153153
let mut cmd = Command::new("robocopy");
154154
cmd.arg(from).arg(to).arg("/s").arg("/e");
@@ -219,7 +219,7 @@ pub fn command_output(cmd: &mut Command) -> anyhow::Result<process::Output> {
219219
output.status,
220220
String::from_utf8_lossy(&output.stderr),
221221
String::from_utf8_lossy(&output.stdout)
222-
));
222+
));
223223
}
224224

225225
Ok(output)
@@ -246,7 +246,8 @@ pub struct MasterCommit {
246246
/// Note that this does not contain try commits today, so it should not be used
247247
/// to validate hashes or expand them generally speaking. This may also change
248248
/// in the future.
249-
pub async fn master_commits() -> Result<Vec<MasterCommit>, Box<dyn std::error::Error + Sync + Send>> {
249+
pub async fn master_commits() -> Result<Vec<MasterCommit>, Box<dyn std::error::Error + Sync + Send>>
250+
{
250251
let response = reqwest::get("https://triage.rust-lang.org/bors-commit-list").await?;
251252
Ok(response.json().await?)
252-
}
253+
}

collector/src/read2.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ mod imp {
196196
if v.capacity() == v.len() {
197197
v.reserve(1);
198198
}
199-
slice::from_raw_parts_mut(v.as_mut_ptr().offset(v.len() as isize), v.capacity() - v.len())
199+
slice::from_raw_parts_mut(
200+
v.as_mut_ptr().offset(v.len() as isize),
201+
v.capacity() - v.len(),
202+
)
200203
}
201-
}
204+
}

site/src/self_profile/crox.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ pub fn generate(pieces: super::Pieces, opt: Opt) -> anyhow::Result<Vec<u8>> {
130130

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

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

136137
let thread_to_collapsed_thread =
137138
generate_thread_to_collapsed_thread_mapping(opt.collapse_threads, &data);

site/src/server.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,9 +1230,12 @@ impl UpdatingStatus {
12301230

12311231
// Returns previous state
12321232
fn set_updating(&self) -> bool {
1233-
match self.0.compare_exchange(false, true, AtomicOrdering::SeqCst, AtomicOrdering::SeqCst) {
1233+
match self
1234+
.0
1235+
.compare_exchange(false, true, AtomicOrdering::SeqCst, AtomicOrdering::SeqCst)
1236+
{
12341237
Ok(b) => b,
1235-
Err(b) => b
1238+
Err(b) => b,
12361239
}
12371240
}
12381241

0 commit comments

Comments
 (0)