Skip to content
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

Add more exceptions to the list #671

Merged
merged 5 commits into from
Oct 29, 2022
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
6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
[package]
name = "crater"
version = "0.1.0"
authors = [
"Brian Anderson <[email protected]>",
"Pietro Albini <[email protected]>",
]
edition = "2018"
edition = "2021"

build = "build.rs"

Expand Down
6 changes: 3 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ fn get_git_sha() -> Option<String> {
let symbolic = cmd(&["git", "rev-parse", "--symbolic", "HEAD"]).unwrap();
let symbolic_full = cmd(&["git", "rev-parse", "--symbolic-full-name", "HEAD"]).unwrap();

println!("cargo:rerun-if-changed=.git/{}", symbolic);
println!("cargo:rerun-if-changed=.git/{symbolic}");
if symbolic != symbolic_full {
println!("cargo:rerun-if-changed=.git/{}", symbolic_full);
println!("cargo:rerun-if-changed=.git/{symbolic_full}");
}

Some(sha)
Expand All @@ -31,5 +31,5 @@ fn main() {
let sha = format!("{:?}", get_git_sha());

let output = std::env::var("OUT_DIR").unwrap();
::std::fs::write(format!("{}/sha", output), sha.as_bytes()).unwrap();
::std::fs::write(format!("{output}/sha"), sha.as_bytes()).unwrap();
}
5 changes: 5 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ crokey = { skip-tests = true } # compiler error checks in tests
"wischli/rpaillier" = { skip-tests = true } # flaky tests
"AntonChernev/suffix-tree-search" = { skip-tests = true } # flaky tests
"0xpr03/yayd" = { skip-tests = true } # network in tests
"gclark916/vulkano_examples" = { skip = true } # spurious proc macro error
"gclark916/vulkano_tri1" = { skip = true } # spurious proc macro error
"Ayrx/binja-rs-hello-world" = { skip = true } # shared directory messed up by first build
"Ninja3047/load-symbols" = { skip = true } # shared directory messed up by first build
"etke/bff" = { skip = true } # shared directory messed up by first build
"APTy/icmp" = { skip-tests = true } # network in tests
"GothAck/rs-async-debug" = { skip-tests = true } # compiler error checks in tests
"hank-der-hafenarbeiter/imperative-rs" = { skip-tests = true } # compiler error checks in tests
Expand Down
3 changes: 1 addition & 2 deletions local-crates/beta-faulty-deps/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[package]
name = "beta-faulty-deps"
version = "0.1.0"
authors = ["Giacomo Pasini <[email protected]>"]
edition = "2018"
edition = "2021"

[dependencies]
error_code = {git = "https://github.com/rust-lang/crater", rev = "f190933e896443e285e3bb6962fb87d7439b8d65"}
Expand Down
3 changes: 1 addition & 2 deletions local-crates/clippy-warn/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "clippy-warn"
version = "0.1.0"
authors = ["Dylan MacKenzie <[email protected]>"]
edition = "2018"
edition = "2021"

[dependencies]
3 changes: 1 addition & 2 deletions local-crates/docs-rs-features/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[package]
name = "docs-rs-features"
version = "0.1.0"
authors = ["Joshua Nelson <[email protected]>"]
edition = "2018"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
3 changes: 1 addition & 2 deletions local-crates/error-code/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[package]
name = "error_code"
version = "0.1.0"
authors = ["Giacomo Pasini <[email protected]>"]
edition = "2018"
edition = "2021"

[dependencies]

Expand Down
3 changes: 1 addition & 2 deletions local-crates/faulty-deps/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[package]
name = "faulty-deps"
version = "0.1.0"
authors = ["Giacomo Pasini <[email protected]>"]
edition = "2018"
edition = "2021"

[dependencies]
error_code = {git = "https://github.com/rust-lang/crater", rev = "c3f462bdab37a93c24b2b172b90564749e892cbc"}
Expand Down
3 changes: 1 addition & 2 deletions local-crates/outdated-lockfile/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[package]
name = "outdated-lockfile"
version = "0.1.0"
authors = ["Pietro Albini <[email protected]>"]
edition = "2018"
edition = "2021"

[dependencies]
3 changes: 1 addition & 2 deletions local-crates/yanked-deps/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[package]
name = "yanked-deps"
version = "0.1.0"
authors = ["Pietro Albini <[email protected]>"]
edition = "2018"
edition = "2021"

[dependencies]
ring = "0.2"
2 changes: 1 addition & 1 deletion src/actions/experiments/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ mod tests {
let crates: Vec<Crate> = db
.query(
"SELECT crate FROM experiment_crates WHERE experiment = ?1 AND skipped = 0",
&[&ex],
[&ex],
|row| {
let krate: String = row.get("crate")?;
Ok(krate.parse().unwrap())
Expand Down
4 changes: 2 additions & 2 deletions src/actions/experiments/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl Action for EditExperiment {
}

let changes = t.execute(
&format!("UPDATE experiments SET {} = ?1 WHERE name = ?2;", col),
&format!("UPDATE experiments SET {col} = ?1 WHERE name = ?2;"),
&[&ex.toolchains[i].to_string(), &self.name],
)?;
assert_eq!(changes, 1);
Expand Down Expand Up @@ -251,7 +251,7 @@ mod tests {
let crates: Vec<Crate> = db
.query(
"SELECT crate FROM experiment_crates WHERE experiment = ?1 AND skipped = 0",
&[&ex],
[&ex],
|row| {
let krate: String = row.get("crate")?;
Ok(krate.parse().unwrap())
Expand Down
6 changes: 3 additions & 3 deletions src/agent/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl ResponseExt for ::reqwest::blocking::Response {
let status = self.status();
let result: ApiResponse<T> = self
.json()
.with_context(|_| format!("failed to parse API response (status code {})", status,))?;
.with_context(|_| format!("failed to parse API response (status code {status})",))?;
match result {
ApiResponse::Success { result } => Ok(result),
ApiResponse::SlowDown => Err(AgentApiError::ServerUnavailable.into()),
Expand All @@ -78,7 +78,7 @@ impl AgentApi {
}

fn build_request(&self, method: Method, url: &str) -> RequestBuilder {
utils::http::prepare_sync(method, &format!("{}/agent-api/{}", self.url, url)).header(
utils::http::prepare_sync(method, &format!("{}/agent-api/{url}", self.url)).header(
AUTHORIZATION,
(CraterToken {
token: self.token.clone(),
Expand All @@ -101,7 +101,7 @@ impl AgentApi {
// We retry these errors. Ideally it's something the
// server would handle, but that's (unfortunately) hard
// in practice.
format!("{:?}", err).contains("database is locked")
format!("{err:?}").contains("database is locked")
};

if retry {
Expand Down
8 changes: 4 additions & 4 deletions src/crates/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ impl Crate {
Crate::Registry(ref details) => format!("reg/{}/{}", details.name, details.version),
Crate::GitHub(ref repo) => {
if let Some(ref sha) = repo.sha {
format!("gh/{}/{}/{}", repo.org, repo.name, sha)
format!("gh/{}/{}/{sha}", repo.org, repo.name)
} else {
format!("gh/{}/{}", repo.org, repo.name)
}
}
Crate::Local(ref name) => format!("local/{}", name),
Crate::Local(ref name) => format!("local/{name}"),
Crate::Path(ref path) => {
format!("path/{}", utf8_percent_encode(path, NON_ALPHANUMERIC))
}
Expand Down Expand Up @@ -132,11 +132,11 @@ impl fmt::Display for Crate {
Crate::Registry(ref krate) => format!("{}-{}", krate.name, krate.version),
Crate::GitHub(ref repo) =>
if let Some(ref sha) = repo.sha {
format!("{}/{}/{}", repo.org, repo.name, sha)
format!("{}/{}/{sha}", repo.org, repo.name)
} else {
format!("{}/{}", repo.org, repo.name)
},
Crate::Local(ref name) => format!("{} (local)", name),
Crate::Local(ref name) => format!("{name} (local)"),
Crate::Path(ref path) => format!("{}", utf8_percent_encode(path, NON_ALPHANUMERIC)),
Crate::Git(ref repo) =>
if let Some(ref sha) = repo.sha {
Expand Down
20 changes: 7 additions & 13 deletions src/db/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ fn migrations() -> Vec<(&'static str, MigrationKind)> {
if let Ok(parsed) = serde_json::from_str(&legacy) {
Ok(match parsed {
LegacyToolchain::Dist(name) => name,
LegacyToolchain::TryBuild { sha } => format!("try#{}", sha),
LegacyToolchain::Master { sha } => format!("master#{}", sha),
LegacyToolchain::TryBuild { sha } => format!("try#{sha}"),
LegacyToolchain::Master { sha } => format!("master#{sha}"),
})
} else {
Ok(legacy)
Expand All @@ -178,7 +178,7 @@ fn migrations() -> Vec<(&'static str, MigrationKind)> {
[],
)?;
t.execute(
&format!("UPDATE results SET toolchain = {}(toolchain);", fn_name),
&format!("UPDATE results SET toolchain = {fn_name}(toolchain);"),
[],
)?;
t.execute("PRAGMA foreign_keys = ON;", [])?;
Expand Down Expand Up @@ -352,17 +352,11 @@ fn migrations() -> Vec<(&'static str, MigrationKind)> {

t.execute("PRAGMA foreign_keys = OFF;", [])?;
t.execute(
&format!("UPDATE experiment_crates SET crate = {}(crate);", fn_name),
[],
)?;
t.execute(
&format!("UPDATE results SET crate = {}(crate);", fn_name),
[],
)?;
t.execute(
&format!("UPDATE crates SET crate = {}(crate);", fn_name),
&format!("UPDATE experiment_crates SET crate = {fn_name}(crate);"),
[],
)?;
t.execute(&format!("UPDATE results SET crate = {fn_name}(crate);"), [])?;
t.execute(&format!("UPDATE crates SET crate = {fn_name}(crate);"), [])?;
t.execute("PRAGMA foreign_keys = ON;", [])?;

Ok(())
Expand Down Expand Up @@ -406,7 +400,7 @@ pub fn execute(db: &mut Connection) -> Fallible<()> {
MigrationKind::SQL(sql) => t.execute_batch(sql),
MigrationKind::Code(code) => code(&t),
}
.with_context(|_| format!("error running migration: {}", name))?;
.with_context(|_| format!("error running migration: {name}"))?;

t.execute("INSERT INTO migrations (name) VALUES (?1)", [&name])?;
t.commit()?;
Expand Down
8 changes: 4 additions & 4 deletions src/experiments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ impl fmt::Display for CrateSelect {
CrateSelect::Full => write!(f, "full"),
CrateSelect::Demo => write!(f, "demo"),
CrateSelect::Dummy => write!(f, "dummy"),
CrateSelect::Top(n) => write!(f, "top-{}", n),
CrateSelect::Top(n) => write!(f, "top-{n}"),
CrateSelect::Local => write!(f, "local"),
CrateSelect::Random(n) => write!(f, "random-{}", n),
CrateSelect::Random(n) => write!(f, "random-{n}"),
CrateSelect::List(list) => {
let mut first = true;
write!(f, "list:")?;
Expand All @@ -109,7 +109,7 @@ impl fmt::Display for CrateSelect {
write!(f, ",")?;
}

write!(f, "{}", krate)?;
write!(f, "{krate}")?;
first = false;
}

Expand Down Expand Up @@ -178,7 +178,7 @@ pub enum Assignee {
impl fmt::Display for Assignee {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Assignee::Agent(ref name) => write!(f, "agent:{}", name),
Assignee::Agent(ref name) => write!(f, "agent:{name}"),
Assignee::Distributed => write!(f, "distributed"),
Assignee::CLI => write!(f, "cli"),
}
Expand Down
8 changes: 4 additions & 4 deletions src/report/archives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn iterate<'a, DB: ReadResults + 'a>(
let log = db
.load_log(ex, tc, krate)
.and_then(|c| c.ok_or_else(|| err_msg("missing logs")))
.with_context(|_| format!("failed to read log of {} on {}", krate, tc));
.with_context(|_| format!("failed to read log of {krate} on {tc}"));

let log_bytes: EncodedLog = match log {
Ok(l) => l,
Expand Down Expand Up @@ -163,15 +163,15 @@ pub fn write_logs_archives<DB: ReadResults, W: ReportWriter>(
for (comparison, archive) in by_comparison.drain(..) {
let data = archive.into_inner()?.finish()?;
dest.write_bytes(
&format!("logs-archives/{}.tar.gz", comparison),
format!("logs-archives/{comparison}.tar.gz"),
data,
&"application/gzip".parse().unwrap(),
EncodingType::Plain,
)?;

archives.push(Archive {
name: format!("{} crates", comparison),
path: format!("logs-archives/{}.tar.gz", comparison),
name: format!("{comparison} crates"),
path: format!("logs-archives/{comparison}.tar.gz"),
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/report/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ fn write_report<W: ReportWriter>(
result_names.len() - 1
});
runs[pos] = Some(BuildTestResultHTML {
res: *idx as usize,
res: *idx,
log: run.log.clone(),
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/report/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn write_crate(
let prefix = if is_child { " * " } else { "* " };
let status_warning = krate
.status
.map(|status| format!(" ({})", status))
.map(|status| format!(" ({status})"))
.unwrap_or_default();

if let ReportConfig::Complete(toolchain) = comparison.report_config() {
Expand Down Expand Up @@ -106,7 +106,7 @@ fn render_markdown(context: &ResultsContext) -> Fallible<String> {
writeln!(rendered, "# Crater report for {}\n\n", context.ex.name)?;

for (comparison, results) in context.categories.iter() {
writeln!(rendered, "\n### {}", comparison)?;
writeln!(rendered, "\n### {comparison}")?;
match results {
ReportCratesMD::Plain(crates) => {
for krate in crates {
Expand Down
Loading