Skip to content

Commit 8059c44

Browse files
authored
chore/easy: fix some clippy lints in move (#14352)
## Description Fixes some clippy lints ignored when [this](#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
1 parent b16e681 commit 8059c44

File tree

6 files changed

+10
-20
lines changed

6 files changed

+10
-20
lines changed

.cargo/config

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ move-clippy = [
2424
"-Aclippy::manual_slice_size_calculation",
2525
"-Aclippy::unwrap-or-default",
2626
"-Aclippy::incorrect_partial_ord_impl_on_ord_type",
27-
"-Aclippy::useless_attribute",
28-
"-Aclippy::manual_while_let_some",
29-
"-Aclippy::redundant_closure",
3027
]
3128

3229
[build]

external-crates/move/move-model/src/spec_translator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ impl TranslatedSpec {
110110
.mk_join_opt_bool(
111111
Operation::And,
112112
Some(exp.clone()),
113-
code.as_ref().map(|c| eq_code(c)),
113+
code.as_ref().map(eq_code),
114114
)
115115
.unwrap()
116116
})
117117
.chain(
118118
self.aborts_with
119119
.iter()
120120
.flat_map(|(_, codes)| codes.iter())
121-
.map(|c| eq_code(c)),
121+
.map(eq_code),
122122
),
123123
)
124124
}

external-crates/move/move-prover/boogie-backend/src/boogie_helpers.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,7 @@ impl TypeIdentToken {
707707

708708
segments.reverse();
709709
let mut cursor = segments.pop().unwrap();
710-
while !segments.is_empty() {
711-
let next = segments.pop().unwrap();
710+
while let Some(next) = segments.pop() {
712711
cursor = format!("ConcatVec({}, {})", cursor, next);
713712
}
714713
cursor

external-crates/move/move-prover/bytecode/src/graph.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ impl<T: Ord + Copy + Debug> Graph<T> {
8686
let mut stack = vec![];
8787
visited.insert(self.entry, false);
8888
stack.push(self.entry);
89-
while !stack.is_empty() {
90-
let n = stack.pop().unwrap();
89+
while let Some(n) = stack.pop() {
9190
if visited[&n] {
9291
visited.entry(n).and_modify(|x| {
9392
*x = false;
@@ -122,8 +121,7 @@ impl<T: Ord + Copy + Debug> Graph<T> {
122121
loop_body.insert(loop_latch);
123122
stack.push(loop_latch);
124123
}
125-
while !stack.is_empty() {
126-
let m = stack.pop().unwrap();
124+
while let Some(m) = stack.pop() {
127125
for p in &self.predecessors[&m] {
128126
if !loop_body.contains(p) {
129127
loop_body.insert(*p);
@@ -194,8 +192,7 @@ impl<T: Ord + Copy + Debug> DomRelation<T> {
194192
let mut grey = BTreeSet::new();
195193
stack.push(graph.entry);
196194
visited.insert(graph.entry);
197-
while !stack.is_empty() {
198-
let curr = stack.pop().unwrap();
195+
while let Some(curr) = stack.pop() {
199196
if grey.contains(&curr) {
200197
let curr_num = self.postorder_num_to_node.len();
201198
self.postorder_num_to_node.push(curr);

external-crates/move/move-prover/bytecode/src/mono_analysis.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ impl<'a> Analyzer<'a> {
218218

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

248247
// Finally do spec functions, after all regular functions and axioms are done.
249-
while !self.todo_spec_funs.is_empty() {
250-
let (fun, inst) = self.todo_spec_funs.pop().unwrap();
248+
while let Some((fun, inst)) = self.todo_spec_funs.pop() {
251249
self.inst_opt = Some(inst);
252250
self.analyze_spec_fun(fun);
253251
let inst = std::mem::take(&mut self.inst_opt).unwrap();

external-crates/move/tools/move-cli/src/sandbox/utils/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) The Diem Core Contributors
22
// Copyright (c) The Move Contributors
33
// SPDX-License-Identifier: Apache-2.0
4-
#[allow(hidden_glob_reexports)]
4+
#![allow(hidden_glob_reexports)]
55
use crate::sandbox::utils::on_disk_state_view::OnDiskStateView;
66
use anyhow::{bail, Result};
77
use colored::Colorize;
@@ -391,8 +391,7 @@ pub(crate) fn explain_publish_error(
391391
stack.push((code_cache.get_module(&dep)?, false));
392392
}
393393

394-
while !stack.is_empty() {
395-
let (cur, is_exit) = stack.pop().unwrap();
394+
while let Some((cur, is_exit)) = stack.pop() {
396395
let cur_id = cur.self_id();
397396
if is_exit {
398397
state.insert(cur_id, false);

0 commit comments

Comments
 (0)