Skip to content

Commit

Permalink
Fix a few cargo clippy (#19110)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
lxfind authored Aug 27, 2024
1 parent e1b9af4 commit 21ee4bf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/sui-genesis-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ impl Builder {

let committee = system_state.get_current_epoch_committee();
for signature in self.signatures.values() {
if self.validators.get(&signature.authority).is_none() {
if !self.validators.contains_key(&signature.authority) {
panic!("found signature for unknown validator: {:#?}", signature);
}

Expand Down
12 changes: 6 additions & 6 deletions sui-execution/v0/sui-adapter/src/temporary_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ impl<'backing> TemporaryStore<'backing> {

pub fn write_object(&mut self, mut object: Object, kind: WriteKind) {
// there should be no write after delete
debug_assert!(self.deleted.get(&object.id()).is_none());
debug_assert!(!self.deleted.contains_key(&object.id()));
// Check it is not read-only
#[cfg(test)] // Movevm should ensure this
if let Some(existing_object) = self.read_object(&object.id()) {
Expand Down Expand Up @@ -380,7 +380,7 @@ impl<'backing> TemporaryStore<'backing> {

pub fn delete_object(&mut self, id: &ObjectID, kind: DeleteKindWithOldVersion) {
// there should be no deletion after write
debug_assert!(self.written.get(id).is_none());
debug_assert!(!self.written.contains_key(id));

// TODO: promote this to an on-in-prod check that raises an invariant_violation
// Check that we are not deleting an immutable object
Expand Down Expand Up @@ -413,7 +413,7 @@ impl<'backing> TemporaryStore<'backing> {

pub fn read_object(&self, id: &ObjectID) -> Option<&Object> {
// there should be no read after delete
debug_assert!(self.deleted.get(id).is_none());
debug_assert!(!self.deleted.contains_key(id));
self.written
.get(id)
.map(|(obj, _kind)| obj)
Expand Down Expand Up @@ -939,7 +939,7 @@ impl<'backing> ChildObjectResolver for TemporaryStore<'backing> {
child_version_upper_bound: SequenceNumber,
) -> SuiResult<Option<Object>> {
// there should be no read after delete
debug_assert!(self.deleted.get(child).is_none());
debug_assert!(!self.deleted.contains_key(child));
let obj_opt = self.written.get(child).map(|(obj, _kind)| obj);
if obj_opt.is_some() {
Ok(obj_opt.cloned())
Expand All @@ -958,8 +958,8 @@ impl<'backing> ChildObjectResolver for TemporaryStore<'backing> {
) -> SuiResult<Option<Object>> {
// You should never be able to try and receive an object after deleting it or writing it in the same
// transaction since `Receiving` doesn't have copy.
debug_assert!(self.deleted.get(receiving_object_id).is_none());
debug_assert!(self.written.get(receiving_object_id).is_none());
debug_assert!(!self.deleted.contains_key(receiving_object_id));
debug_assert!(!self.written.contains_key(receiving_object_id));
self.store.get_object_received_at_version(
owner,
receiving_object_id,
Expand Down

0 comments on commit 21ee4bf

Please sign in to comment.