Skip to content

Commit

Permalink
chore: fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Aug 9, 2024
1 parent 1ec32eb commit a90e556
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ features = ["all"]
[patch.crates-io]
bp-consensus = { git = "https://github.com/BP-WG/bp-core", branch = "master" }
bp-invoice = { git = "https://github.com/BP-WG/bp-std.git", branch = "master" }
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "contract-state2" }
rgb-core = { git = "https://github.com/RGB-WG/rgb-core", branch = "master" }
2 changes: 1 addition & 1 deletion src/containers/consignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ Check-SHA256: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
#[test]
fn error_transfer_strs() {
let s = include_str!("../../asset/armored_transfer.default");
assert!(matches!(Transfer::from_str(s), Ok(_)));
assert!(Transfer::from_str(s).is_ok());

// Wrong Id
assert!(
Expand Down
54 changes: 26 additions & 28 deletions src/persistence/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,36 +1000,34 @@ impl ContractStateEvolve for MemContract<MemContractState> {
}

fn evolve_state(&mut self, op: OrdOpRef) -> Result<(), confinement::Error> {
(move || -> Result<(), SerializeError> {
fn writer(me: &mut MemContract<MemContractState>) -> MemContractWriter {
MemContractWriter {
writer: Box::new(
|witness_id: XWitnessId, ord: WitnessOrd| -> Result<(), SerializeError> {
// NB: We do not check the existence of the witness since we have a
// newer version anyway and even if it is
// known we have to replace it
me.filter.insert(witness_id, ord);
Ok(())
},
),
contract: &mut me.unfiltered,
}
fn writer(me: &mut MemContract<MemContractState>) -> MemContractWriter {
MemContractWriter {
writer: Box::new(
|witness_id: XWitnessId, ord: WitnessOrd| -> Result<(), SerializeError> {
// NB: We do not check the existence of the witness since we have a
// newer version anyway and even if it is
// known we have to replace it
me.filter.insert(witness_id, ord);
Ok(())
},
),
contract: &mut me.unfiltered,
}
match op {
OrdOpRef::Genesis(genesis) => {
let mut writer = writer(self);
writer.add_genesis(genesis)
}
OrdOpRef::Transition(transition, witness_id, ord) => {
let mut writer = writer(self);
writer.add_transition(transition, witness_id, ord)
}
OrdOpRef::Extension(extension, witness_id, ord) => {
let mut writer = writer(self);
writer.add_extension(extension, witness_id, ord)
}
}
match op {
OrdOpRef::Genesis(genesis) => {
let mut writer = writer(self);
writer.add_genesis(genesis)
}
})()
OrdOpRef::Transition(transition, witness_id, ord) => {
let mut writer = writer(self);
writer.add_transition(transition, witness_id, ord)
}
OrdOpRef::Extension(extension, witness_id, ord) => {
let mut writer = writer(self);
writer.add_extension(extension, witness_id, ord)
}
}
.map_err(|err| match err {
SerializeError::Io(_) => {
unreachable!("I/O errors are not possible for memory structures")
Expand Down
2 changes: 1 addition & 1 deletion src/persistence/stock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ impl<S: StashProvider, H: StateProvider, P: IndexProvider> Stock<S, H, P> {
.map_err(StockError::from)
}

#[allow(clippy::multiple_bound_locations)]
#[allow(clippy::multiple_bound_locations, clippy::type_complexity)]
pub fn contract_iface_class<C: IfaceClass>(
&self,
contract_id: ContractId,
Expand Down

0 comments on commit a90e556

Please sign in to comment.