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

This commit is contained in:
DaniPopes 2022-12-22 20:05:00 +01:00 committed by GitHub
parent 0cc6be4f5c
commit d8d4eac3ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -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 }
@ -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)
}