Skip to content

Use clippy from Rust 1.63.0 in CI #1383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 17, 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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ workflows:
matrix:
parameters:
# Run with MSRV and some modern stable Rust
rust-version: ["1.59.0", "1.62.0"]
rust-version: ["1.59.0", "1.63.0"]
- benchmarking:
requires:
- package_vm
Expand Down
2 changes: 1 addition & 1 deletion contracts/floaty/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cosmwasm_std::Addr;

pub const CONFIG_KEY: &[u8] = b"config";

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct State {
pub verifier: Addr,
pub beneficiary: Addr,
Expand Down
2 changes: 1 addition & 1 deletion contracts/hackatom/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cosmwasm_std::Addr;

pub const CONFIG_KEY: &[u8] = b"config";

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct State {
pub verifier: Addr,
pub beneficiary: Addr,
Expand Down
6 changes: 3 additions & 3 deletions contracts/ibc-reflect-send/src/ibc_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

/// This is the message we send over the IBC channel
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum PacketMsg {
Dispatch { msgs: Vec<CosmosMsg> },
Expand All @@ -21,14 +21,14 @@ pub type DispatchResponse = ();

/// This is the success response we send on ack for PacketMsg::WhoAmI.
/// Return the caller's account address on the remote chain
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct WhoAmIResponse {
pub account: String,
}

/// This is the success response we send on ack for PacketMsg::Balance.
/// Just acknowledge success or error
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct BalancesResponse {
pub account: String,
pub balances: Vec<Coin>,
Expand Down
4 changes: 2 additions & 2 deletions contracts/ibc-reflect-send/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ use cosmwasm_storage::{
pub const KEY_CONFIG: &[u8] = b"config";
pub const PREFIX_ACCOUNTS: &[u8] = b"accounts";

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
pub struct Config {
pub admin: Addr,
}

#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq)]
pub struct AccountData {
/// last block balance was updated (0 is never)
pub last_update_time: Timestamp,
Expand Down
2 changes: 1 addition & 1 deletion contracts/ibc-reflect/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub const KEY_CONFIG: &[u8] = b"config";
pub const KEY_PENDING_CHANNEL: &[u8] = b"pending";
pub const PREFIX_ACCOUNTS: &[u8] = b"accounts";

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct Config {
pub reflect_code_id: u64,
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/queue/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

// we store one entry for each item in the queue
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct Item {
pub value: i32,
}
2 changes: 1 addition & 1 deletion contracts/reflect/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use cosmwasm_storage::{
const CONFIG_KEY: &[u8] = b"config";
const RESULT_PREFIX: &[u8] = b"result";

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct State {
pub owner: Addr,
}
Expand Down
6 changes: 3 additions & 3 deletions contracts/staking/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn claims_read(storage: &dyn Storage) -> ReadonlyBucket<Uint128> {
}

/// Investment info is fixed at initialization, and is used to control the function of the contract
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct InvestmentInfo {
/// owner created the contract and takes a cut
pub owner: Addr,
Expand All @@ -50,7 +50,7 @@ pub struct InvestmentInfo {
}

/// Info to display the derivative token in a UI
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct TokenInfo {
/// name of the derivative token
pub name: String,
Expand All @@ -61,7 +61,7 @@ pub struct TokenInfo {
}

/// Supply is dynamic and tracks the current supply of staked and ERC20 tokens.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Default, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default, JsonSchema)]
pub struct Supply {
/// issued is how many derivative tokens this contract has issued
pub issued: Uint128,
Expand Down
1 change: 1 addition & 0 deletions devtools/check_workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ cargo fmt
)
(cd packages/storage && cargo build && cargo clippy --all-targets --features iterator -- -D warnings)
(cd packages/schema && cargo build && cargo clippy --all-targets -- -D warnings)
(cd packages/schema-derive && cargo build && cargo clippy --all-targets -- -D warnings)
(cd packages/vm && cargo build --features iterator,stargate && cargo clippy --all-targets --features iterator,stargate -- -D warnings)
1 change: 1 addition & 0 deletions devtools/test_workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ cargo fmt
(cd packages/std && cargo test --features iterator)
(cd packages/storage && cargo test --features iterator)
(cd packages/schema && cargo test)
(cd packages/schema-derive && cargo test)
(cd packages/vm && cargo test --features iterator,stargate)
2 changes: 1 addition & 1 deletion packages/profiler/src/code_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl BlockStore {
}

/// Represents a non-branching Wasm code block.
#[derive(Debug, MemoryUsage, Hash, PartialEq)]
#[derive(Debug, MemoryUsage, Hash, PartialEq, Eq)]
pub struct CodeBlock {
inner: Vec<OperatorSymbol>,
}
Expand Down
2 changes: 1 addition & 1 deletion packages/profiler/src/operators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::hash::Hash;
use loupe::MemoryUsage;
use wasmer::wasmparser::Operator;

#[derive(Debug, Clone, Hash, PartialEq, MemoryUsage)]
#[derive(Debug, Clone, Hash, PartialEq, Eq, MemoryUsage)]
pub enum OperatorSymbol {
Unreachable,
Nop,
Expand Down
4 changes: 4 additions & 0 deletions packages/schema-derive/src/cw_serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub fn cw_serde_impl(input: DeriveInput) -> DeriveInput {
PartialEq,
schemars::JsonSchema
)]
#[allow(clippy::derive_partial_eq_without_eq)] // Allow users of `#[cw_serde]` to not implement Eq without clippy complaining
#[serde(deny_unknown_fields)]
#input
},
Expand All @@ -23,6 +24,7 @@ pub fn cw_serde_impl(input: DeriveInput) -> DeriveInput {
PartialEq,
schemars::JsonSchema
)]
#[allow(clippy::derive_partial_eq_without_eq)] // Allow users of `#[cw_serde]` to not implement Eq without clippy complaining
#[serde(deny_unknown_fields, rename_all = "snake_case")]
#input
},
Expand Down Expand Up @@ -52,6 +54,7 @@ mod tests {
PartialEq,
schemars::JsonSchema
)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[serde(deny_unknown_fields)]
pub struct InstantiateMsg {
pub verifier: String,
Expand Down Expand Up @@ -82,6 +85,7 @@ mod tests {
PartialEq,
schemars::JsonSchema
)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[serde(deny_unknown_fields, rename_all = "snake_case")]
pub enum SudoMsg {
StealFunds {
Expand Down
2 changes: 1 addition & 1 deletion packages/schema/src/query_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn check_api_integrity<T: QueryResponses + ?Sized>(
Ok(())
}

#[derive(Debug, Error, PartialEq)]
#[derive(Debug, Error, PartialEq, Eq)]
pub enum IntegrityError {
#[error("the structure of the QueryMsg schema was unexpected")]
InvalidQueryMsgSchema,
Expand Down
10 changes: 5 additions & 5 deletions packages/schema/tests/idl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,34 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_json::Value;

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct InstantiateMsg {
pub admin: String,
pub cap: u128,
}

// failure modes to help test wasmd, based on this comment
// https://github.com/cosmwasm/wasmd/issues/8#issuecomment-576146751
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {
Mint { amount: u128 },
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema, QueryResponses)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, QueryResponses)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
#[returns(u128)]
Balance { account: String },
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum SudoMsg {
SetAdmin { new_admin: String },
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct MigrateMsg {
pub admin: String,
pub cap: u128,
Expand Down
2 changes: 1 addition & 1 deletion packages/std/src/coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::fmt;

use crate::math::Uint128;

#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, JsonSchema)]
pub struct Coin {
pub denom: String,
pub amount: Uint128,
Expand Down
2 changes: 1 addition & 1 deletion packages/std/src/errors/system_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::Binary;
///
/// Such errors are only created by the VM. The error type is defined in the standard library, to ensure
/// the contract understands the error format without creating a dependency on cosmwasm-vm.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum SystemError {
Expand Down
32 changes: 16 additions & 16 deletions packages/std/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::timestamp::Timestamp;
/// These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts
/// (contracts that directly speak the IBC protocol via 6 entry points)
#[non_exhaustive]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum IbcMsg {
/// Sends bank tokens owned by the contract to the given address on another chain.
Expand Down Expand Up @@ -51,7 +51,7 @@ pub enum IbcMsg {
CloseChannel { channel_id: String },
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct IbcEndpoint {
pub port_id: String,
pub channel_id: String,
Expand All @@ -60,7 +60,7 @@ pub struct IbcEndpoint {
/// In IBC each package must set at least one type of timeout:
/// the timestamp or the block height. Using this rather complex enum instead of
/// two timeout fields we ensure that at least one timeout is set.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct IbcTimeout {
// use private fields to enforce the use of constructors, which ensure that at least one is set
Expand Down Expand Up @@ -115,7 +115,7 @@ impl From<IbcTimeoutBlock> for IbcTimeout {

/// IbcChannel defines all information on a channel.
/// This is generally used in the hand-shake process, but can be queried directly.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[non_exhaustive]
pub struct IbcChannel {
pub endpoint: IbcEndpoint,
Expand Down Expand Up @@ -150,7 +150,7 @@ impl IbcChannel {
/// IbcOrder defines if a channel is ORDERED or UNORDERED
/// Values come from https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/ibc/core/channel/v1/channel.proto#L69-L80
/// Naming comes from the protobuf files and go translations.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub enum IbcOrder {
#[serde(rename = "ORDER_UNORDERED")]
Unordered,
Expand Down Expand Up @@ -193,7 +193,7 @@ impl Ord for IbcTimeoutBlock {
}
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[non_exhaustive]
pub struct IbcPacket {
/// The raw data sent from the other side in the packet
Expand Down Expand Up @@ -226,7 +226,7 @@ impl IbcPacket {
}
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[non_exhaustive]
pub struct IbcAcknowledgement {
pub data: Binary,
Expand All @@ -247,7 +247,7 @@ impl IbcAcknowledgement {
}

/// The message that is passed into `ibc_channel_open`
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum IbcChannelOpenMsg {
Expand Down Expand Up @@ -306,14 +306,14 @@ pub type IbcChannelOpenResponse = ();
#[cfg(feature = "ibc3")]
pub type IbcChannelOpenResponse = Option<Ibc3ChannelOpenResponse>;

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct Ibc3ChannelOpenResponse {
/// We can set the channel version to a different one than we were called with
pub version: String,
}

/// The message that is passed into `ibc_channel_connect`
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum IbcChannelConnectMsg {
Expand Down Expand Up @@ -366,7 +366,7 @@ impl From<IbcChannelConnectMsg> for IbcChannel {
}

/// The message that is passed into `ibc_channel_close`
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum IbcChannelCloseMsg {
Expand Down Expand Up @@ -403,7 +403,7 @@ impl From<IbcChannelCloseMsg> for IbcChannel {
}

/// The message that is passed into `ibc_packet_receive`
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[non_exhaustive]
pub struct IbcPacketReceiveMsg {
pub packet: IbcPacket,
Expand All @@ -424,7 +424,7 @@ impl IbcPacketReceiveMsg {
}

/// The message that is passed into `ibc_packet_ack`
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[non_exhaustive]
pub struct IbcPacketAckMsg {
pub acknowledgement: IbcAcknowledgement,
Expand Down Expand Up @@ -457,7 +457,7 @@ impl IbcPacketAckMsg {
}

/// The message that is passed into `ibc_packet_timeout`
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[non_exhaustive]
pub struct IbcPacketTimeoutMsg {
pub packet: IbcPacket,
Expand All @@ -484,7 +484,7 @@ impl IbcPacketTimeoutMsg {
/// Callbacks that have return values (like receive_packet)
/// or that cannot redispatch messages (like the handshake callbacks)
/// will use other Response types
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[non_exhaustive]
pub struct IbcBasicResponse<T = Empty> {
/// Optional list of messages to pass. These will be executed in order.
Expand Down Expand Up @@ -626,7 +626,7 @@ impl<T> IbcBasicResponse<T> {
// Where the acknowledgement bytes contain an encoded error message to be returned to
// the calling chain. (Returning ContractResult::Err will abort processing of this packet
// and not inform the calling chain).
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[non_exhaustive]
pub struct IbcReceiveResponse<T = Empty> {
/// The bytes we return to the contract that sent the packet.
Expand Down
Loading