Skip to content

Commit d0e29fa

Browse files
committed
fix lints
1 parent 84e21d2 commit d0e29fa

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

crates/lib/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ fn get_user_agent() -> String {
2929
let os = std::env::consts::OS;
3030
let arch = std::env::consts::ARCH;
3131
let group = env::var("PKGX_USER_AGENT_GROUP");
32-
let name = if group.is_ok() {
33-
format!("pkgx[{}]", group.unwrap())
32+
let name = if let Ok(valid_group) = group {
33+
format!("pkgx[{}]", valid_group)
3434
} else {
3535
"pkgx".to_string()
3636
};

crates/lib/src/install.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ where
9898
}
9999
});
100100

101-
let stream = stream
102-
.map_err(|e| futures::io::Error::new(futures::io::ErrorKind::Other, e))
103-
.into_async_read();
101+
let stream = stream.map_err(futures::io::Error::other).into_async_read();
104102
let stream = stream.compat();
105103

106104
// Step 2: Create a XZ decoder
@@ -169,8 +167,7 @@ async fn symlink(installation: &Installation, config: &Config) -> Result<(), Box
169167
};
170168
let most_minor = versions
171169
.iter()
172-
.filter(|(version, _)| minor_range.satisfies(version))
173-
.next_back()
170+
.rfind(|(version, _)| minor_range.satisfies(version))
174171
.ok_or_else(|| {
175172
anyhow::anyhow!(
176173
"Could not find most minor version for {}",
@@ -189,8 +186,7 @@ async fn symlink(installation: &Installation, config: &Config) -> Result<(), Box
189186

190187
let most_major = versions
191188
.iter()
192-
.filter(|(version, _)| major_range.satisfies(version))
193-
.next_back()
189+
.rfind(|(version, _)| major_range.satisfies(version))
194190
.ok_or_else(|| anyhow::anyhow!("Could not find most major version"))?;
195191

196192
if most_major.0 != installation.pkg.version {

crates/lib/src/sync.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ async fn download_and_extract_pantry(url: &str, dest: &PathBuf) -> Result<(), Bo
5858

5959
let stream = rsp.bytes_stream();
6060

61-
let stream = stream
62-
.map_err(|e| futures::io::Error::new(futures::io::ErrorKind::Other, e))
63-
.into_async_read();
61+
let stream = stream.map_err(futures::io::Error::other).into_async_read();
6462
let stream = stream.compat();
6563

6664
let decoder = XzDecoder::new(stream);

0 commit comments

Comments
 (0)