Skip to content

Commit 91d28f2

Browse files
Fix lints
1 parent 9503083 commit 91d28f2

File tree

7 files changed

+14
-22
lines changed

7 files changed

+14
-22
lines changed

src/crates/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl TryFrom<&'_ PackageId> for Crate {
9494
[_, _, "path", path] => Ok(Crate::Path(path.to_string())),
9595
[_, _, "git", repo] => {
9696
if repo.starts_with("https://github.com") {
97-
Ok(Crate::GitHub(repo.replace("#", "/").parse()?))
97+
Ok(Crate::GitHub(repo.replace('#', "/").parse()?))
9898
} else {
9999
let mut parts = repo.split('#').rev().collect::<Vec<_>>();
100100
let url = parts.pop();

src/db/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl CustomizeConnection<Connection, ::rusqlite::Error> for ConnectionCustomizer
3030
pub struct Database {
3131
pool: Pool<SqliteConnectionManager>,
3232
// The tempfile is stored here to drop it after all the connections are closed
33-
tempfile: Option<Arc<NamedTempFile>>,
33+
_tempfile: Option<Arc<NamedTempFile>>,
3434
}
3535

3636
impl Database {
@@ -76,7 +76,7 @@ impl Database {
7676

7777
Ok(Database {
7878
pool,
79-
tempfile: tempfile.map(Arc::new),
79+
_tempfile: tempfile.map(Arc::new),
8080
})
8181
}
8282

src/report/markdown.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn write_crate(
6666
let prefix = if is_child { " * " } else { "* " };
6767
let status_warning = krate
6868
.status
69-
.map(|status| format!(" ({})", status.to_string()))
69+
.map(|status| format!(" ({})", status))
7070
.unwrap_or_default();
7171

7272
if let ReportConfig::Complete(toolchain) = comparison.report_config() {
@@ -82,7 +82,7 @@ fn write_crate(
8282
krate.name,
8383
status_warning,
8484
krate.url,
85-
comparison.to_string(),
85+
comparison,
8686
conj,
8787
runs[run],
8888
runs[1],
@@ -92,13 +92,7 @@ fn write_crate(
9292
writeln!(
9393
&mut rendered,
9494
"{}[{}{}]({}) {} [start]({}/log.txt) | [end]({}/log.txt)",
95-
prefix,
96-
krate.name,
97-
status_warning,
98-
krate.url,
99-
comparison.to_string(),
100-
runs[1],
101-
runs[3]
95+
prefix, krate.name, status_warning, krate.url, comparison, runs[1], runs[3]
10296
)?;
10397
};
10498

@@ -112,7 +106,7 @@ fn render_markdown(context: &ResultsContext) -> Fallible<String> {
112106
writeln!(&mut rendered, "# Crater report for {}\n\n", context.ex.name)?;
113107

114108
for (comparison, results) in context.categories.iter() {
115-
writeln!(&mut rendered, "\n### {}", comparison.to_string())?;
109+
writeln!(&mut rendered, "\n### {}", comparison)?;
116110
match results {
117111
ReportCratesMD::Plain(crates) => {
118112
for krate in crates {

src/report/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ pub fn generate_report<DB: ReadResults>(
235235
log: crate_to_path_fragment(tc, krate, SanitizationContext::Url)
236236
.to_str()
237237
.unwrap()
238-
.replace(r"\", "/"), // Normalize paths in reports generated on Windows
238+
.replace('\'', "/"), // Normalize paths in reports generated on Windows
239239
})
240240
});
241241
// Convert errors to Nones
@@ -290,7 +290,7 @@ fn write_logs<DB: ReadResults, W: ReportWriter>(
290290
let content = db
291291
.load_log(ex, tc, krate)
292292
.and_then(|c| c.ok_or_else(|| err_msg("missing logs")))
293-
.with_context(|_| format!("failed to read log of {} on {}", krate, tc.to_string()));
293+
.with_context(|_| format!("failed to read log of {} on {}", krate, tc));
294294
let content = match content {
295295
Ok(c) => c,
296296
Err(e) => {

src/runner/tasks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl fmt::Debug for TaskStep {
7676

7777
write!(f, "{}", name)?;
7878
if let Some(tc) = tc {
79-
write!(f, " {}", tc.to_string())?;
79+
write!(f, " {}", tc)?;
8080
}
8181
if quiet {
8282
write!(f, " (quiet)")?;

src/runner/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ fn failure_reason(err: &Error) -> FailureReason {
1717
for cause in err.iter_chain() {
1818
if let Some(&CommandError::SandboxOOM) = cause.downcast_ctx() {
1919
return FailureReason::OOM;
20-
} else if let Some(&CommandError::NoOutputFor(_)) = cause.downcast_ctx() {
21-
return FailureReason::Timeout;
22-
} else if let Some(&CommandError::Timeout(_)) = cause.downcast_ctx() {
20+
} else if let Some(&CommandError::NoOutputFor(_) | &CommandError::Timeout(_)) =
21+
cause.downcast_ctx()
22+
{
2323
return FailureReason::Timeout;
2424
} else if let Some(reason) = cause.downcast_ctx::<FailureReason>() {
2525
return reason.clone();

src/server/routes/agent.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,7 @@ fn handle_results(resp: Fallible<Response<Body>>) -> Response<Body> {
244244
fn handle_errors(err: Rejection) -> Result<Response<Body>, Rejection> {
245245
let error = if let Some(compat) = err.find_cause::<Compat<HttpError>>() {
246246
Some(*compat.get_ref())
247-
} else if let StatusCode::NOT_FOUND = err.status() {
248-
Some(HttpError::NotFound)
249-
} else if let StatusCode::METHOD_NOT_ALLOWED = err.status() {
247+
} else if let StatusCode::NOT_FOUND | StatusCode::METHOD_NOT_ALLOWED = err.status() {
250248
Some(HttpError::NotFound)
251249
} else {
252250
None

0 commit comments

Comments
 (0)