chore: fix clippy (#2059)

This commit is contained in:
Georgios Konstantopoulos 2023-01-16 18:11:27 -08:00 committed by GitHub
parent 5330a688ea
commit f2099a8eaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 78 deletions

View File

@ -4,9 +4,10 @@ use regex::Regex;
use std::collections::HashSet;
/// Used to filter contracts that should be _included_ in the abigen generation.
#[derive(Debug, Clone)]
#[derive(Debug, Default, Clone)]
pub enum ContractFilter {
/// Include all contracts
#[default]
All,
/// Only include contracts that match the filter
Select(SelectContracts),
@ -27,12 +28,6 @@ impl ContractFilter {
}
}
impl Default for ContractFilter {
fn default() -> Self {
ContractFilter::All
}
}
impl From<SelectContracts> for ContractFilter {
fn from(f: SelectContracts) -> Self {
ContractFilter::Select(f)

View File

@ -152,7 +152,6 @@ impl Abigen {
self
}
#[must_use]
#[deprecated = "Use format instead"]
#[doc(hidden)]
pub fn rustfmt(mut self, rustfmt: bool) -> Self {

View File

@ -282,7 +282,7 @@ impl<M> Clone for Multicall<M> {
contract: self.contract.clone(),
version: self.version,
legacy: self.legacy,
block: self.block.clone(),
block: self.block,
calls: self.calls.clone(),
}
}

View File

@ -355,10 +355,11 @@ pub struct MinedBlock {
}
/// The pre-defined block parameter for balance API endpoints
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, Default)]
pub enum Tag {
Earliest,
Pending,
#[default]
Latest,
}
@ -372,12 +373,6 @@ impl Display for Tag {
}
}
impl Default for Tag {
fn default() -> Self {
Tag::Latest
}
}
/// The list sorting preference
#[derive(Clone, Copy, Debug)]
pub enum Sort {
@ -466,8 +461,9 @@ impl TokenQueryOption {
}
/// The pre-defined block type for retrieving mined blocks
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, Default)]
pub enum BlockType {
#[default]
CanonicalBlocks,
Uncles,
}
@ -481,12 +477,6 @@ impl Display for BlockType {
}
}
impl Default for BlockType {
fn default() -> Self {
BlockType::CanonicalBlocks
}
}
impl Client {
/// Returns the Ether balance of a given address.
///

View File

@ -214,12 +214,13 @@ impl<T: JsonRpcClientWrapper> QuorumProvider<T> {
}
/// Determines when the provider reached a quorum
#[derive(Debug, Copy, Clone)]
#[derive(Debug, Default, Copy, Clone)]
pub enum Quorum {
/// The quorum is reached when all providers return the exact value
All,
/// The quorum is reached when the majority of the providers have returned a
/// matching value, taking into account their weight.
#[default]
Majority,
/// The quorum is reached when the cumulative weight of a matching return
/// exceeds the given percentage of the total weight.
@ -257,12 +258,6 @@ impl Quorum {
}
}
impl Default for Quorum {
fn default() -> Self {
Quorum::Majority
}
}
// A future that returns the provider's response and it's index within the
// `QuorumProvider` provider set
#[cfg(target_arch = "wasm32")]

View File

@ -677,7 +677,7 @@ pub struct YulDetails {
pub optimizer_steps: Option<String>,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
pub enum EvmVersion {
Homestead,
TangerineWhistle,
@ -687,15 +687,10 @@ pub enum EvmVersion {
Petersburg,
Istanbul,
Berlin,
#[default]
London,
}
impl Default for EvmVersion {
fn default() -> Self {
Self::London
}
}
impl EvmVersion {
/// Checks against the given solidity `semver::Version`
pub fn normalize_version(self, version: &Version) -> Option<EvmVersion> {
@ -786,9 +781,10 @@ pub struct DebuggingSettings {
}
/// How to treat revert (and require) reason strings.
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
pub enum RevertStrings {
/// "default" does not inject compiler-generated revert strings and keeps user-supplied ones.
#[default]
Default,
/// "strip" removes all revert strings (if possible, i.e. if literals are used) keeping
/// side-effects
@ -827,12 +823,6 @@ impl FromStr for RevertStrings {
}
}
impl Default for RevertStrings {
fn default() -> Self {
RevertStrings::Default
}
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct SettingsMetadata {
/// Use only literal content and not URLs (false by default)
@ -868,19 +858,14 @@ impl From<BytecodeHash> for SettingsMetadata {
/// Determines the hash method for the metadata hash that is appended to the bytecode.
///
/// Solc's default is `Ipfs`, see <https://docs.soliditylang.org/en/latest/using-the-compiler.html#compiler-api>.
#[derive(Clone, Debug, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, Default, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum BytecodeHash {
#[default]
Ipfs,
None,
Bzzr1,
}
impl Default for BytecodeHash {
fn default() -> Self {
BytecodeHash::Ipfs
}
}
impl FromStr for BytecodeHash {
type Err = String;
@ -1036,8 +1021,9 @@ pub struct ModelCheckerSettings {
}
/// Which model checker engine to run.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
pub enum ModelCheckerEngine {
#[default]
Default,
All,
BMC,
@ -1070,12 +1056,6 @@ impl FromStr for ModelCheckerEngine {
}
}
impl Default for ModelCheckerEngine {
fn default() -> Self {
ModelCheckerEngine::Default
}
}
/// Which model checker targets to check.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]

View File

@ -53,11 +53,13 @@ impl FileFilter for TestFileFilter {
/// A type that can apply a filter to a set of preprocessed [FilteredSources] in order to set sparse
/// output for specific files
#[derive(Default)]
pub enum SparseOutputFilter {
/// Sets the configured [OutputSelection] for dirty files only.
///
/// In other words, we request the output of solc only for files that have been detected as
/// _dirty_.
#[default]
AllDirty,
/// Apply an additional filter to [FilteredSources] to
Custom(Box<dyn FileFilter>),
@ -176,12 +178,6 @@ impl From<Box<dyn FileFilter>> for SparseOutputFilter {
}
}
impl Default for SparseOutputFilter {
fn default() -> Self {
SparseOutputFilter::AllDirty
}
}
impl fmt::Debug for SparseOutputFilter {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {

View File

@ -1,25 +1,16 @@
use crate::Graph;
use std::{collections::HashSet, io, io::Write, str::FromStr};
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)]
pub enum Charset {
// when operating in a console on windows non-UTF-8 byte sequences are not supported on
// stdout, See also [`StdoutLock`]
#[cfg_attr(target_os = "windows", default)]
Utf8,
#[cfg_attr(not(target_os = "windows"), default)]
Ascii,
}
impl Default for Charset {
fn default() -> Self {
// when operating in a console on windows non-UTF-8 byte sequences are not supported on
// stdout, See also [`StdoutLock`]
#[cfg(target_os = "windows")]
{
Charset::Ascii
}
#[cfg(not(target_os = "windows"))]
Charset::Utf8
}
}
impl FromStr for Charset {
type Err = String;