Skip to content

Commit

Permalink
chore/easy: fix some clippy lints in move (#14352)
Browse files Browse the repository at this point in the history
## Description 

Fixes some clippy lints ignored when
[this](MystenLabs/sui#14167) PR was inteoduced.
Others coming shortly.

## Test Plan 

Existing

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
oxade authored Oct 19, 2023
1 parent 3523104 commit 26728d5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
4 changes: 2 additions & 2 deletions move-model/src/spec_translator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ impl TranslatedSpec {
.mk_join_opt_bool(
Operation::And,
Some(exp.clone()),
code.as_ref().map(|c| eq_code(c)),
code.as_ref().map(eq_code),
)
.unwrap()
})
.chain(
self.aborts_with
.iter()
.flat_map(|(_, codes)| codes.iter())
.map(|c| eq_code(c)),
.map(eq_code),
),
)
}
Expand Down
3 changes: 1 addition & 2 deletions move-prover/boogie-backend/src/boogie_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,7 @@ impl TypeIdentToken {

segments.reverse();
let mut cursor = segments.pop().unwrap();
while !segments.is_empty() {
let next = segments.pop().unwrap();
while let Some(next) = segments.pop() {
cursor = format!("ConcatVec({}, {})", cursor, next);
}
cursor
Expand Down
9 changes: 3 additions & 6 deletions move-prover/bytecode/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ impl<T: Ord + Copy + Debug> Graph<T> {
let mut stack = vec![];
visited.insert(self.entry, false);
stack.push(self.entry);
while !stack.is_empty() {
let n = stack.pop().unwrap();
while let Some(n) = stack.pop() {
if visited[&n] {
visited.entry(n).and_modify(|x| {
*x = false;
Expand Down Expand Up @@ -122,8 +121,7 @@ impl<T: Ord + Copy + Debug> Graph<T> {
loop_body.insert(loop_latch);
stack.push(loop_latch);
}
while !stack.is_empty() {
let m = stack.pop().unwrap();
while let Some(m) = stack.pop() {
for p in &self.predecessors[&m] {
if !loop_body.contains(p) {
loop_body.insert(*p);
Expand Down Expand Up @@ -194,8 +192,7 @@ impl<T: Ord + Copy + Debug> DomRelation<T> {
let mut grey = BTreeSet::new();
stack.push(graph.entry);
visited.insert(graph.entry);
while !stack.is_empty() {
let curr = stack.pop().unwrap();
while let Some(curr) = stack.pop() {
if grey.contains(&curr) {
let curr_num = self.postorder_num_to_node.len();
self.postorder_num_to_node.push(curr);
Expand Down
6 changes: 2 additions & 4 deletions move-prover/bytecode/src/mono_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ impl<'a> Analyzer<'a> {

// Next do todo-list for regular functions, while self.inst_opt contains the
// specific instantiation.
while !self.todo_funs.is_empty() {
let (fun, variant, inst) = self.todo_funs.pop().unwrap();
while let Some((fun, variant, inst)) = self.todo_funs.pop() {
self.inst_opt = Some(inst);
self.analyze_fun(
self.targets
Expand All @@ -246,8 +245,7 @@ impl<'a> Analyzer<'a> {
}

// Finally do spec functions, after all regular functions and axioms are done.
while !self.todo_spec_funs.is_empty() {
let (fun, inst) = self.todo_spec_funs.pop().unwrap();
while let Some((fun, inst)) = self.todo_spec_funs.pop() {
self.inst_opt = Some(inst);
self.analyze_spec_fun(fun);
let inst = std::mem::take(&mut self.inst_opt).unwrap();
Expand Down
5 changes: 2 additions & 3 deletions tools/move-cli/src/sandbox/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) The Diem Core Contributors
// Copyright (c) The Move Contributors
// SPDX-License-Identifier: Apache-2.0
#[allow(hidden_glob_reexports)]
#![allow(hidden_glob_reexports)]
use crate::sandbox::utils::on_disk_state_view::OnDiskStateView;
use anyhow::{bail, Result};
use colored::Colorize;
Expand Down Expand Up @@ -391,8 +391,7 @@ pub(crate) fn explain_publish_error(
stack.push((code_cache.get_module(&dep)?, false));
}

while !stack.is_empty() {
let (cur, is_exit) = stack.pop().unwrap();
while let Some((cur, is_exit)) = stack.pop() {
let cur_id = cur.self_id();
if is_exit {
state.insert(cur_id, false);
Expand Down

0 comments on commit 26728d5

Please sign in to comment.