Skip to content

Commit d86caab

Browse files
committed
chore: fix lints
1 parent 1111405 commit d86caab

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

cli/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ impl Args {
3939
return Ok(core_dir.to_owned());
4040
}
4141

42-
if let Some(core_dir) = env::var("PLATFORMIO_CORE_DIR").ok() {
42+
if let Ok(core_dir) = env::var("PLATFORMIO_CORE_DIR") {
4343
return Ok(PathBuf::from(core_dir));
4444
}
4545

46+
#[expect(deprecated)] // nix doesn't support Windows anyway
4647
if let Some(home_dir) = env::home_dir() {
4748
return Ok(home_dir.join(".platformio"));
4849
}
@@ -55,7 +56,7 @@ impl Args {
5556
return Ok(Some(workspace_dir.to_owned()));
5657
}
5758

58-
if let Some(workspace_dir) = env::var("PLATFORMIO_WORKSPACE_DIR").ok() {
59+
if let Ok(workspace_dir) = env::var("PLATFORMIO_WORKSPACE_DIR") {
5960
return Ok(Some(PathBuf::from(workspace_dir)));
6061
}
6162

cli/src/manifest.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub struct ExternalSpec {
7070

7171
pub fn extract_artifacts(root: &Path) -> eyre::Result<Vec<Artifact>> {
7272
let mut artifacts = vec![];
73-
extract_artifacts_rec(&mut artifacts, &root, &root)?;
73+
extract_artifacts_rec(&mut artifacts, root, root)?;
7474
Ok(artifacts)
7575
}
7676

@@ -88,7 +88,7 @@ fn extract_artifacts_rec(
8888

8989
let piopm = path.join(".piopm");
9090
if !piopm.exists() {
91-
extract_artifacts_rec(artifacts, &root, &path)?;
91+
extract_artifacts_rec(artifacts, root, &path)?;
9292
continue;
9393
}
9494

cli/src/registry/mod.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::path::PathBuf;
2-
31
use color_eyre::eyre::{self, Context};
42
use http_cache_reqwest::{CACacheManager, Cache, CacheMode, HttpCache, HttpCacheOptions};
53
use reqwest::{Client, Url};
@@ -12,7 +10,7 @@ use sha2::{Digest, Sha256};
1210

1311
use crate::{
1412
lockfile::Dependency,
15-
manifest::{Artifact, ExternalSpec, PackageManifest, PackageType, PlatformIOSpec},
13+
manifest::{ExternalSpec, PackageManifest, PackageType, PlatformIOSpec},
1614
};
1715

1816
pub struct RegistryClient {
@@ -131,16 +129,12 @@ pub struct PackageSpec {
131129

132130
#[derive(Deserialize, Clone, Debug)]
133131
pub struct VersionSpec {
134-
pub name: String,
135132
pub files: Vec<File>,
136133
}
137134

138135
impl VersionSpec {
139136
pub fn supports(&self, system: &System) -> Option<&File> {
140-
self.files
141-
.iter()
142-
.filter(|f| f.system.supports(system))
143-
.next()
137+
self.files.iter().find(|f| f.system.supports(system))
144138
}
145139
}
146140

@@ -179,7 +173,7 @@ impl SystemSpec {
179173
pub fn supports(&self, system: &System) -> bool {
180174
match self {
181175
SystemSpec::Wildcard => true,
182-
SystemSpec::Systems(systems) => systems.contains(&system),
176+
SystemSpec::Systems(systems) => systems.contains(system),
183177
}
184178
}
185179
}

0 commit comments

Comments
 (0)