Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

fix(contract): add setter for MultiBindings' rustfmt #1948

Merged
merged 1 commit into from
Dec 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ethers-contract/ethers-contract-abigen/src/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ impl std::ops::Deref for MultiAbigen {
}
}

impl std::ops::DerefMut for MultiAbigen {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.abigens
}
}

impl From<Vec<Abigen>> for MultiAbigen {
fn from(abigens: Vec<Abigen>) -> Self {
Self { abigens }
Expand Down Expand Up @@ -372,6 +378,16 @@ impl MultiBindings {
self.expansion.contracts.is_empty()
}

/// Specify whether or not to format the code using a locally installed copy
/// of `rustfmt`.
///
/// Note that in case `rustfmt` does not exist or produces an error, the
/// unformatted code will be used.
pub fn rustfmt(mut self, rustfmt: bool) -> Self {
self.rustfmt = rustfmt;
self
}

fn into_inner(self, single_file: bool) -> MultiBindingsInner {
self.expansion.into_bindings(single_file, self.rustfmt)
}
Expand Down