Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

update rust 1.63 & remove clippy TODO #421

Merged
merged 6 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl ::core::clone::Clone for TestDiemCryptoHasher {
fn clone(&self) -> TestDiemCryptoHasher {
match *self {
TestDiemCryptoHasher(ref __self_0_0) => {
TestDiemCryptoHasher(::core::clone::Clone::clone(&(*__self_0_0)))
TestDiemCryptoHasher(::core::clone::Clone::clone(__self_0_0))
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions language/evm/move-to-yul/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,16 +379,16 @@ impl Generator {
);

// Skip the existence flag and create a pointer.
let make_ptr = self.call_builtin_str(

self.call_builtin_str(
ctx,
YulFunction::MakePtr,
vec![
"true".to_string(),
format!("add({}, ${{RESOURCE_EXISTS_FLAG_SIZE}})", base_offset),
]
.into_iter(),
);
make_ptr
)
}

/// Returns an expression for checking whether a resource exists.
Expand Down
2 changes: 1 addition & 1 deletion language/move-analyzer/src/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl fmt::Display for IdentType {
}
Self::FunctionType(mod_ident, name, type_args, arg_names, arg_types, ret, acquires) => {
let type_args_str = if !type_args.is_empty() {
let mut s = "<".to_string();
let mut s = '<'.to_string();
s.push_str(&type_list_to_ide_string(type_args));
s.push('>');
s
Expand Down
2 changes: 1 addition & 1 deletion language/move-borrow-graph/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::collections::{BTreeMap, BTreeSet};
// Definitions
//**************************************************************************************************

#[derive(Clone, Debug, Default, PartialEq)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct BorrowGraph<Loc: Copy, Lbl: Clone + Ord>(BTreeMap<RefID, Ref<Loc, Lbl>>);

//**************************************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion language/move-bytecode-verifier/src/dependencies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ fn verify_script_visibility_usage(
}
_ => continue,
};
match (current_is_entry, script_functions.contains(&fhandle_idx)) {
match (current_is_entry, script_functions.contains(fhandle_idx)) {
(true, true) => (),
(_, true) => {
return Err(PartialVMError::new(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl std::fmt::Display for Label {
}

/// AbstractState is the analysis state over which abstract interpretation is performed.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct AbstractState {
current_function: Option<FunctionDefinitionIndex>,
locals: BTreeMap<LocalIndex, AbstractValue>,
Expand Down
10 changes: 1 addition & 9 deletions language/move-bytecode-verifier/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,11 @@ use move_binary_format::{
file_format::{CompiledModule, CompiledScript},
};

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct VerifierConfig {
pub max_loop_depth: Option<usize>,
}

impl Default for VerifierConfig {
fn default() -> Self {
Self {
max_loop_depth: None,
}
}
}

/// Helper for a "canonical" verification of a module.
///
/// Clients that rely on verification should call the proper passes
Expand Down
4 changes: 2 additions & 2 deletions language/move-command-line-common/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl<'a, I: Iterator<Item = (ValueToken, &'a str)>> Parser<'a, ValueToken, I> {
let contents = contents
.strip_prefix("b\"")
.unwrap()
.strip_suffix("\"")
.strip_suffix('\"')
.unwrap();
ParsedValue::Vector(
contents
Expand All @@ -226,7 +226,7 @@ impl<'a, I: Iterator<Item = (ValueToken, &'a str)>> Parser<'a, ValueToken, I> {
let contents = contents
.strip_prefix("x\"")
.unwrap()
.strip_suffix("\"")
.strip_suffix('\"')
.unwrap()
.to_ascii_lowercase();
ParsedValue::Vector(
Expand Down
2 changes: 1 addition & 1 deletion language/move-compiler/src/attr_derivation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub fn attr_params(attr: &Attribute) -> Vec<&Attribute> {
pub fn attr_value(attr: &Attribute) -> Option<(&Name, Option<&AttributeValue>)> {
match &attr.value {
Attribute_::Name(n) => Some((n, None)),
Attribute_::Assigned(n, v) => Some((n, Some(&*v))),
Attribute_::Assigned(n, v) => Some((n, Some(v))),
_ => None,
}
}
Expand Down
2 changes: 1 addition & 1 deletion language/move-compiler/src/cfgir/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub struct ModuleDefinition {
// Constants
//**************************************************************************************************

#[derive(PartialEq, Debug, Clone)]
#[derive(PartialEq, Eq, Debug, Clone)]
pub struct Constant {
pub attributes: Attributes,
pub loc: Loc,
Expand Down
2 changes: 1 addition & 1 deletion language/move-compiler/src/cfgir/borrows/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub enum Value {
}
pub type Values = Vec<Value>;

#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct BorrowState {
locals: UniqueMap<Var, Value>,
acquired_resources: BTreeMap<StructName, Loc>,
Expand Down
10 changes: 5 additions & 5 deletions language/move-compiler/src/expansion/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub enum Neighbor {

pub type Fields<T> = UniqueMap<Field, (usize, T)>;

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StructTypeParameter {
pub is_phantom: bool,
pub name: Name,
Expand All @@ -170,7 +170,7 @@ pub enum StructFields {
// Functions
//**************************************************************************************************

#[derive(PartialEq, Debug, Clone)]
#[derive(PartialEq, Eq, Debug, Clone)]
pub enum Visibility {
Public(Loc),
Friend(Loc),
Expand Down Expand Up @@ -286,7 +286,7 @@ pub enum SpecBlockMember_ {
}
pub type SpecBlockMember = Spanned<SpecBlockMember_>;

#[derive(PartialEq, Clone, Debug)]
#[derive(PartialEq, Eq, Clone, Debug)]
pub enum SpecConditionKind_ {
Assert,
Assume,
Expand All @@ -304,14 +304,14 @@ pub enum SpecConditionKind_ {
}
pub type SpecConditionKind = Spanned<SpecConditionKind_>;

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PragmaProperty_ {
pub name: Name,
pub value: Option<PragmaValue>,
}
pub type PragmaProperty = Spanned<PragmaProperty_>;

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum PragmaValue {
Literal(Value),
Ident(ModuleAccess),
Expand Down
16 changes: 8 additions & 8 deletions language/move-compiler/src/hlir/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ pub struct ModuleDefinition {
// Structs
//**************************************************************************************************

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct StructDefinition {
pub attributes: Attributes,
pub abilities: AbilitySet,
pub type_parameters: Vec<StructTypeParameter>,
pub fields: StructFields,
}

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum StructFields {
Defined(Vec<(Field, BaseType)>),
Native(Loc),
Expand All @@ -96,7 +96,7 @@ pub struct Constant {
// Functions
//**************************************************************************************************

#[derive(PartialEq, Debug, Clone)]
#[derive(PartialEq, Eq, Debug, Clone)]
pub struct FunctionSignature {
pub type_parameters: Vec<TParam>,
pub parameters: Vec<(Var, SingleType)>,
Expand Down Expand Up @@ -145,14 +145,14 @@ pub enum BaseType_ {
}
pub type BaseType = Spanned<BaseType_>;

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum SingleType_ {
Base(BaseType),
Ref(bool, BaseType),
}
pub type SingleType = Spanned<SingleType_>;

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
#[allow(clippy::large_enum_variant)]
pub enum Type_ {
Unit,
Expand Down Expand Up @@ -238,7 +238,7 @@ pub type LValue = Spanned<LValue_>;
// Expressions
//**************************************************************************************************

#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum UnitCase {
Trailing,
Implicit,
Expand All @@ -254,7 +254,7 @@ pub struct ModuleCall {
pub acquires: BTreeMap<StructName, Loc>,
}

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum BuiltinFunction_ {
MoveTo(BaseType),
MoveFrom(BaseType),
Expand All @@ -281,7 +281,7 @@ pub enum Value_ {
}
pub type Value = Spanned<Value_>;

#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum MoveOpAnnotation {
// 'move' annotated by the user
FromUser,
Expand Down
12 changes: 6 additions & 6 deletions language/move-compiler/src/naming/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ pub struct ModuleDefinition {
// Structs
//**************************************************************************************************

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct StructDefinition {
pub attributes: Attributes,
pub abilities: AbilitySet,
pub type_parameters: Vec<StructTypeParameter>,
pub fields: StructFields,
}

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct StructTypeParameter {
pub param: TParam,
pub is_phantom: bool,
}

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum StructFields {
Defined(Fields<Type>),
Native(Loc),
Expand All @@ -92,7 +92,7 @@ pub enum StructFields {
// Functions
//**************************************************************************************************

#[derive(PartialEq, Debug, Clone)]
#[derive(PartialEq, Eq, Debug, Clone)]
pub struct FunctionSignature {
pub type_parameters: Vec<TParam>,
pub parameters: Vec<(Var, Type)>,
Expand Down Expand Up @@ -209,7 +209,7 @@ pub enum ExpDotted_ {
}
pub type ExpDotted = Spanned<ExpDotted_>;

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
#[allow(clippy::large_enum_variant)]
pub enum BuiltinFunction_ {
MoveTo(Option<Type>),
Expand Down Expand Up @@ -1030,7 +1030,7 @@ impl AstDebug for Exp_ {
e.ast_debug(w);
}
E::DerefBorrow(ed) => {
w.write("(&*)");
w.write("()");
ed.ast_debug(w)
}
E::Cast(e, ty) => {
Expand Down
20 changes: 10 additions & 10 deletions language/move-compiler/src/parser/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ new_name!(StructName);

pub type ResourceLoc = Option<Loc>;

#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct StructTypeParameter {
pub is_phantom: bool,
pub name: Name,
Expand Down Expand Up @@ -240,7 +240,7 @@ pub struct FunctionSignature {
pub return_type: Type,
}

#[derive(PartialEq, Debug, Clone)]
#[derive(PartialEq, Eq, Debug, Clone)]
pub enum Visibility {
Public(Loc),
Script(Loc),
Expand Down Expand Up @@ -312,21 +312,21 @@ pub enum SpecBlockTarget_ {

pub type SpecBlockTarget = Spanned<SpecBlockTarget_>;

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PragmaProperty_ {
pub name: Name,
pub value: Option<PragmaValue>,
}

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum PragmaValue {
Literal(Value),
Ident(NameAccessChain),
}

pub type PragmaProperty = Spanned<PragmaProperty_>;

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SpecApplyPattern_ {
pub visibility: Option<Visibility>,
pub name_pattern: Vec<SpecApplyFragment>,
Expand All @@ -335,7 +335,7 @@ pub struct SpecApplyPattern_ {

pub type SpecApplyPattern = Spanned<SpecApplyPattern_>;

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SpecApplyFragment_ {
Wildcard,
NamePart(Name),
Expand Down Expand Up @@ -391,7 +391,7 @@ pub enum SpecBlockMember_ {
pub type SpecBlockMember = Spanned<SpecBlockMember_>;

// Specification condition kind.
#[derive(PartialEq, Clone, Debug)]
#[derive(PartialEq, Eq, Clone, Debug)]
pub enum SpecConditionKind_ {
Assert,
Assume,
Expand Down Expand Up @@ -489,14 +489,14 @@ pub enum Value_ {
}
pub type Value = Spanned<Value_>;

#[derive(Debug, PartialEq, Copy, Clone)]
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum UnaryOp_ {
// !
Not,
}
pub type UnaryOp = Spanned<UnaryOp_>;

#[derive(Debug, PartialEq, Copy, Clone)]
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum BinOp_ {
// Int ops
// +
Expand Down Expand Up @@ -548,7 +548,7 @@ pub enum BinOp_ {
}
pub type BinOp = Spanned<BinOp_>;

#[derive(Debug, PartialEq, Copy, Clone)]
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum QuantKind_ {
Forall,
Exists,
Expand Down
Loading