Skip to content

Commit dcba480

Browse files
committed
Fix some clippy warnings
1 parent 782f371 commit dcba480

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

tools/src/schedule/archlinux.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ impl TryInto<ArchPkg> for NewPkg {
7171

7272
fn try_into(self: NewPkg) -> Result<ArchPkg> {
7373
Ok(ArchPkg {
74-
name: self.name.get(0).ok_or_else(|| anyhow!("Missing pkg name field"))?.to_string(),
75-
base: self.base.get(0).ok_or_else(|| anyhow!("Missing pkg base field"))?.to_string(),
76-
filename: self.filename.get(0).ok_or_else(|| anyhow!("Missing filename field"))?.to_string(),
77-
version: self.version.get(0).ok_or_else(|| anyhow!("Missing version field"))?.to_string(),
78-
architecture: self.architecture.get(0).ok_or_else(|| anyhow!("Missing architecture field"))?.to_string(),
79-
packager: self.packager.get(0).ok_or_else(|| anyhow!("Missing packager field"))?.to_string(),
74+
name: self.name.first().ok_or_else(|| anyhow!("Missing pkg name field"))?.to_string(),
75+
base: self.base.first().ok_or_else(|| anyhow!("Missing pkg base field"))?.to_string(),
76+
filename: self.filename.first().ok_or_else(|| anyhow!("Missing filename field"))?.to_string(),
77+
version: self.version.first().ok_or_else(|| anyhow!("Missing version field"))?.to_string(),
78+
architecture: self.architecture.first().ok_or_else(|| anyhow!("Missing architecture field"))?.to_string(),
79+
packager: self.packager.first().ok_or_else(|| anyhow!("Missing packager field"))?.to_string(),
8080
})
8181
}
8282
}

worker/src/download.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@ pub async fn download(url_str: &str, path: &Path) -> Result<PathBuf> {
1212
let filename = url.path_segments()
1313
.ok_or_else(|| format_err!("Url doesn't seem to have a path"))?
1414
.last()
15-
.ok_or_else(|| format_err!("Failed to get filename from path"))?;
15+
.ok_or_else(|| format_err!("Failed to get filename from path"))?
16+
.to_owned();
1617
if filename.is_empty() {
17-
bail!("Filename is empty");
18+
bail!("Filename detected from url is empty");
1819
}
1920

20-
let target = path.join(filename);
21+
let target = path.join(&filename);
2122

2223
info!("Downloading {:?} to {:?}", url_str, target);
2324
let client = reqwest::Client::new();
24-
let mut stream = client.get(&url.to_string())
25+
let mut stream = client.get(url)
2526
.send()
2627
.await?
2728
.error_for_status()?

worker/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub struct HttpHeartBeat<'a> {
3434
}
3535

3636
#[async_trait]
37-
impl<'a> heartbeat::HeartBeat for HttpHeartBeat<'a> {
37+
impl heartbeat::HeartBeat for HttpHeartBeat<'_> {
3838
fn interval(&self) -> Duration {
3939
Duration::from_secs(PING_INTERVAL)
4040
}

worker/src/rebuild.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub async fn rebuild(ctx: &Context<'_>, log: &mut Vec<u8>,) -> Result<Vec<(PkgAr
128128
.await
129129
.with_context(|| anyhow!("Failed to download build input from {:?}", input_url))?
130130
} else {
131-
artifacts.get(0)
131+
artifacts.first()
132132
.context("Failed to use first artifact as build input")?
133133
.1.to_owned()
134134
};

0 commit comments

Comments
 (0)