Skip to content

Commit 578b9b4

Browse files
committed
chore: use FnMut instead of FnOnce + Copy
FnOnce + Copy doesn't really make sense.
1 parent 7638a8d commit 578b9b4

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

crates/compilers/src/compilers/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub trait CompilerSettings:
7575
type Restrictions: CompilerSettingsRestrictions;
7676

7777
/// Executes given fn with mutable reference to configured [OutputSelection].
78-
fn update_output_selection(&mut self, f: impl FnOnce(&mut OutputSelection) + Copy);
78+
fn update_output_selection(&mut self, f: impl FnMut(&mut OutputSelection));
7979

8080
/// Returns true if artifacts compiled with given `other` config are compatible with this
8181
/// config and if compilation can be skipped.

crates/compilers/src/compilers/multi.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ impl CompilerSettings for MultiCompilerSettings {
204204
self.solc.can_use_cached(&other.solc) && self.vyper.can_use_cached(&other.vyper)
205205
}
206206

207-
fn update_output_selection(&mut self, f: impl FnOnce(&mut OutputSelection) + Copy) {
208-
self.solc.update_output_selection(f);
207+
fn update_output_selection(&mut self, mut f: impl FnMut(&mut OutputSelection)) {
208+
self.solc.update_output_selection(&mut f);
209209
self.vyper.update_output_selection(f);
210210
}
211211

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ impl CompilerSettingsRestrictions for SolcRestrictions {
288288
impl CompilerSettings for SolcSettings {
289289
type Restrictions = SolcRestrictions;
290290

291-
fn update_output_selection(&mut self, f: impl FnOnce(&mut OutputSelection) + Copy) {
292-
f(&mut self.settings.output_selection)
291+
fn update_output_selection(&mut self, mut f: impl FnMut(&mut OutputSelection)) {
292+
f(&mut self.settings.output_selection);
293293
}
294294

295295
fn can_use_cached(&self, other: &Self) -> bool {

crates/compilers/src/compilers/vyper/settings.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ impl CompilerSettingsRestrictions for VyperRestrictions {
2121
impl CompilerSettings for VyperSettings {
2222
type Restrictions = VyperRestrictions;
2323

24-
fn update_output_selection(&mut self, f: impl FnOnce(&mut OutputSelection)) {
25-
f(&mut self.output_selection)
24+
fn update_output_selection(&mut self, mut f: impl FnMut(&mut OutputSelection)) {
25+
f(&mut self.output_selection);
2626
}
2727

2828
fn can_use_cached(&self, other: &Self) -> bool {

crates/compilers/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,10 @@ impl<T: ArtifactOutput<CompilerContract = C::CompilerContract>, C: Compiler> Pro
430430

431431
/// Invokes [CompilerSettings::update_output_selection] on the project's settings and all
432432
/// additional settings profiles.
433-
pub fn update_output_selection(&mut self, f: impl FnOnce(&mut OutputSelection) + Copy) {
434-
self.settings.update_output_selection(f);
433+
pub fn update_output_selection(&mut self, mut f: impl FnMut(&mut OutputSelection)) {
434+
self.settings.update_output_selection(&mut f);
435435
self.additional_settings.iter_mut().for_each(|(_, s)| {
436-
s.update_output_selection(f);
436+
s.update_output_selection(&mut f);
437437
});
438438
}
439439
}

0 commit comments

Comments
 (0)