Skip to content

Commit e4c5c8e

Browse files
committed
chore: clippy
1 parent f9cb4fa commit e4c5c8e

File tree

9 files changed

+17
-17
lines changed

9 files changed

+17
-17
lines changed

crates/artifacts/solc/src/error.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,11 @@ impl fmt::Display for Error {
150150
// unless it also contains a source location, in which case the entire error message is an
151151
// old style error message, like:
152152
// path/to/file:line:column: ErrorType: message
153-
if lines.clone().next().map_or(false, |l| {
154-
l.contains(short_msg) && l.bytes().filter(|b| *b == b':').count() < 3
155-
}) {
153+
if lines
154+
.clone()
155+
.next()
156+
.is_some_and(|l| l.contains(short_msg) && l.bytes().filter(|b| *b == b':').count() < 3)
157+
{
156158
let _ = lines.next();
157159
}
158160

crates/artifacts/solc/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ impl SolcInput {
110110
let mut yul_sources = Sources::new();
111111

112112
for (file, source) in sources {
113-
if file.extension().map_or(false, |e| e == "yul") {
113+
if file.extension().is_some_and(|e| e == "yul") {
114114
yul_sources.insert(file, source);
115-
} else if file.extension().map_or(false, |e| e == "sol") {
115+
} else if file.extension().is_some_and(|e| e == "sol") {
116116
solidity_sources.insert(file, source);
117117
}
118118
}

crates/artifacts/solc/src/output_selection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ impl OutputSelection {
149149
/// TODO: correctly process wildcard keys to reduce false negatives
150150
pub fn is_subset_of(&self, other: &Self) -> bool {
151151
self.0.iter().all(|(file, selection)| {
152-
other.0.get(file).map_or(false, |other_selection| {
152+
other.0.get(file).is_some_and(|other_selection| {
153153
selection.iter().all(|(contract, outputs)| {
154-
other_selection.get(contract).map_or(false, |other_outputs| {
154+
other_selection.get(contract).is_some_and(|other_outputs| {
155155
outputs.iter().all(|output| other_outputs.contains(output))
156156
})
157157
})

crates/artifacts/vyper/src/input.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl VyperInput {
2222
let mut interfaces = Sources::new();
2323

2424
for (path, content) in sources {
25-
if path.extension().map_or(false, |ext| ext == VYPER_INTERFACE_EXTENSION) {
25+
if path.extension().is_some_and(|ext| ext == VYPER_INTERFACE_EXTENSION) {
2626
// Interface .vyi files should be removed from the output selection.
2727
settings.output_selection.0.remove(path.to_string_lossy().as_ref());
2828
interfaces.insert(path, content);

crates/compilers/src/cache.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ impl GroupedSources {
616616

617617
/// Returns true if the file was included with the given version.
618618
pub fn contains(&self, file: &Path, version: &Version) -> bool {
619-
self.inner.get(file).map_or(false, |versions| versions.contains(version))
619+
self.inner.get(file).is_some_and(|versions| versions.contains(version))
620620
}
621621
}
622622

@@ -783,9 +783,7 @@ impl<T: ArtifactOutput, C: Compiler> ArtifactsCacheInner<'_, T, C> {
783783

784784
let mut dirty_profiles = HashSet::new();
785785
for (profile, settings) in &self.cache.profiles {
786-
if !existing_profiles
787-
.get(profile.as_str())
788-
.map_or(false, |p| p.can_use_cached(settings))
786+
if !existing_profiles.get(profile.as_str()).is_some_and(|p| p.can_use_cached(settings))
789787
{
790788
trace!("dirty profile: {}", profile);
791789
dirty_profiles.insert(profile.clone());

crates/compilers/src/compile/output/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ impl<C: Compiler> AggregatedCompilerOutput<C> {
872872

873873
self.contracts.contracts_with_files().filter(|(path, _, _)| *path == contract_path).any(
874874
|(_, _, contract)| {
875-
contract.abi.as_ref().map_or(false, |abi| abi.functions.contains_key("IS_TEST"))
875+
contract.abi.as_ref().is_some_and(|abi| abi.functions.contains_key("IS_TEST"))
876876
},
877877
)
878878
}

crates/compilers/src/compilers/solc/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ impl<V: Ord + Copy> Restriction<V> {
201201
///
202202
/// If given None, only returns true if no restrictions are set
203203
pub fn satisfies(&self, value: Option<V>) -> bool {
204-
self.min.map_or(true, |min| value.map_or(false, |v| v >= min))
205-
&& self.max.map_or(true, |max| value.map_or(false, |v| v <= max))
204+
self.min.map_or(true, |min| value.is_some_and(|v| v >= min))
205+
&& self.max.map_or(true, |max| value.is_some_and(|v| v <= max))
206206
}
207207

208208
/// Combines two restrictions into a new one

crates/compilers/src/filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl<'a> SparseOutputFilter<'a> {
142142
.collect();
143143

144144
// Remove clean sources, those will be read from cache.
145-
full_compilation.retain(|file| sources.0.get(file).map_or(false, |s| s.is_dirty()));
145+
full_compilation.retain(|file| sources.0.get(file).is_some_and(|s| s.is_dirty()));
146146

147147
settings.update_output_selection(|selection| {
148148
trace!(

crates/compilers/src/resolver/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl SolData {
4545
/// This will attempt to parse the solidity AST and extract the imports and version pragma. If
4646
/// parsing fails, we'll fall back to extract that info via regex
4747
pub fn parse(content: &str, file: &Path) -> Self {
48-
let is_yul = file.extension().map_or(false, |ext| ext == "yul");
48+
let is_yul = file.extension().is_some_and(|ext| ext == "yul");
4949
let mut version = None;
5050
let mut experimental = None;
5151
let mut imports = Vec::<Spanned<SolImport>>::new();

0 commit comments

Comments
 (0)