Skip to content

Commit 249155c

Browse files
committed
Add Eq implementations suggested by clippy
1 parent 61b1874 commit 249155c

File tree

34 files changed

+90
-88
lines changed

34 files changed

+90
-88
lines changed

contracts/floaty/src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use cosmwasm_std::Addr;
55

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

8-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
8+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
99
pub struct State {
1010
pub verifier: Addr,
1111
pub beneficiary: Addr,

contracts/hackatom/src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use cosmwasm_std::Addr;
55

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

8-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
8+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
99
pub struct State {
1010
pub verifier: Addr,
1111
pub beneficiary: Addr,

contracts/ibc-reflect-send/src/ibc_msg.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use schemars::JsonSchema;
33
use serde::{Deserialize, Serialize};
44

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

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

2929
/// This is the success response we send on ack for PacketMsg::Balance.
3030
/// Just acknowledge success or error
31-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
31+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
3232
pub struct BalancesResponse {
3333
pub account: String,
3434
pub balances: Vec<Coin>,

contracts/ibc-reflect-send/src/state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ use cosmwasm_storage::{
99
pub const KEY_CONFIG: &[u8] = b"config";
1010
pub const PREFIX_ACCOUNTS: &[u8] = b"accounts";
1111

12-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
12+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
1313
pub struct Config {
1414
pub admin: Addr,
1515
}
1616

17-
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq)]
17+
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq)]
1818
pub struct AccountData {
1919
/// last block balance was updated (0 is never)
2020
pub last_update_time: Timestamp,

contracts/ibc-reflect/src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub const KEY_CONFIG: &[u8] = b"config";
1111
pub const KEY_PENDING_CHANNEL: &[u8] = b"pending";
1212
pub const PREFIX_ACCOUNTS: &[u8] = b"accounts";
1313

14-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
14+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
1515
pub struct Config {
1616
pub reflect_code_id: u64,
1717
}

contracts/queue/src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use schemars::JsonSchema;
22
use serde::{Deserialize, Serialize};
33

44
// we store one entry for each item in the queue
5-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
5+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
66
pub struct Item {
77
pub value: i32,
88
}

contracts/reflect/src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use cosmwasm_storage::{
1010
const CONFIG_KEY: &[u8] = b"config";
1111
const RESULT_PREFIX: &[u8] = b"result";
1212

13-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
13+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
1414
pub struct State {
1515
pub owner: Addr,
1616
}

contracts/staking/src/state.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn claims_read(storage: &dyn Storage) -> ReadonlyBucket<Uint128> {
3333
}
3434

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

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

6363
/// Supply is dynamic and tracks the current supply of staked and ERC20 tokens.
64-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Default, JsonSchema)]
64+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, Default, JsonSchema)]
6565
pub struct Supply {
6666
/// issued is how many derivative tokens this contract has issued
6767
pub issued: Uint128,

packages/profiler/src/code_blocks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl BlockStore {
6969
}
7070

7171
/// Represents a non-branching Wasm code block.
72-
#[derive(Debug, MemoryUsage, Hash, PartialEq)]
72+
#[derive(Debug, MemoryUsage, Hash, PartialEq, Eq)]
7373
pub struct CodeBlock {
7474
inner: Vec<OperatorSymbol>,
7575
}

packages/profiler/src/operators.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::hash::Hash;
33
use loupe::MemoryUsage;
44
use wasmer::wasmparser::Operator;
55

6-
#[derive(Debug, Clone, Hash, PartialEq, MemoryUsage)]
6+
#[derive(Debug, Clone, Hash, PartialEq, Eq, MemoryUsage)]
77
pub enum OperatorSymbol {
88
Unreachable,
99
Nop,

packages/schema-derive/src/cw_serde.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub fn cw_serde_impl(input: DeriveInput) -> DeriveInput {
1111
PartialEq,
1212
schemars::JsonSchema
1313
)]
14+
#[allow(clippy::derive_partial_eq_without_eq)] // Allow users of `#[cw_serde]` to not implement Eq without clippy complaining
1415
#[serde(deny_unknown_fields)]
1516
#input
1617
},
@@ -23,6 +24,7 @@ pub fn cw_serde_impl(input: DeriveInput) -> DeriveInput {
2324
PartialEq,
2425
schemars::JsonSchema
2526
)]
27+
#[allow(clippy::derive_partial_eq_without_eq)] // Allow users of `#[cw_serde]` to not implement Eq without clippy complaining
2628
#[serde(deny_unknown_fields, rename_all = "snake_case")]
2729
#input
2830
},

packages/schema/src/query_response.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn check_api_integrity<T: QueryResponses + ?Sized>(
7777
Ok(())
7878
}
7979

80-
#[derive(Debug, Error, PartialEq)]
80+
#[derive(Debug, Error, PartialEq, Eq)]
8181
pub enum IntegrityError {
8282
#[error("the structure of the QueryMsg schema was unexpected")]
8383
InvalidQueryMsgSchema,

packages/schema/tests/idl.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@ use schemars::JsonSchema;
55
use serde::{Deserialize, Serialize};
66
use serde_json::Value;
77

8-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
8+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
99
pub struct InstantiateMsg {
1010
pub admin: String,
1111
pub cap: u128,
1212
}
1313

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

22-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema, QueryResponses)]
22+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema, QueryResponses)]
2323
#[serde(rename_all = "snake_case")]
2424
pub enum QueryMsg {
2525
#[returns(u128)]
2626
Balance { account: String },
2727
}
2828

29-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
29+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
3030
#[serde(rename_all = "snake_case")]
3131
pub enum SudoMsg {
3232
SetAdmin { new_admin: String },
3333
}
3434

35-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
35+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
3636
pub struct MigrateMsg {
3737
pub admin: String,
3838
pub cap: u128,

packages/std/src/coins.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::fmt;
44

55
use crate::math::Uint128;
66

7-
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, JsonSchema)]
7+
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, JsonSchema)]
88
pub struct Coin {
99
pub denom: String,
1010
pub amount: Uint128,

packages/std/src/errors/system_error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::Binary;
1212
///
1313
/// Such errors are only created by the VM. The error type is defined in the standard library, to ensure
1414
/// the contract understands the error format without creating a dependency on cosmwasm-vm.
15-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
15+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
1616
#[serde(rename_all = "snake_case")]
1717
#[non_exhaustive]
1818
pub enum SystemError {

packages/std/src/ibc.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::timestamp::Timestamp;
1818
/// These are messages in the IBC lifecycle. Only usable by IBC-enabled contracts
1919
/// (contracts that directly speak the IBC protocol via 6 entry points)
2020
#[non_exhaustive]
21-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
21+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
2222
#[serde(rename_all = "snake_case")]
2323
pub enum IbcMsg {
2424
/// Sends bank tokens owned by the contract to the given address on another chain.
@@ -51,7 +51,7 @@ pub enum IbcMsg {
5151
CloseChannel { channel_id: String },
5252
}
5353

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

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

196-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
196+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
197197
#[non_exhaustive]
198198
pub struct IbcPacket {
199199
/// The raw data sent from the other side in the packet
@@ -226,7 +226,7 @@ impl IbcPacket {
226226
}
227227
}
228228

229-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
229+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
230230
#[non_exhaustive]
231231
pub struct IbcAcknowledgement {
232232
pub data: Binary,
@@ -247,7 +247,7 @@ impl IbcAcknowledgement {
247247
}
248248

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

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

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

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

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

426426
/// The message that is passed into `ibc_packet_ack`
427-
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
427+
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
428428
#[non_exhaustive]
429429
pub struct IbcPacketAckMsg {
430430
pub acknowledgement: IbcAcknowledgement,
@@ -457,7 +457,7 @@ impl IbcPacketAckMsg {
457457
}
458458

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

packages/std/src/math/decimal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use super::{Uint128, Uint256};
2222
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, JsonSchema)]
2323
pub struct Decimal(#[schemars(with = "String")] Uint128);
2424

25-
#[derive(Error, Debug, PartialEq)]
25+
#[derive(Error, Debug, PartialEq, Eq)]
2626
#[error("Decimal range exceeded")]
2727
pub struct DecimalRangeExceeded;
2828

packages/std/src/math/decimal256.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use super::Uint256;
2525
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, JsonSchema)]
2626
pub struct Decimal256(#[schemars(with = "String")] Uint256);
2727

28-
#[derive(Error, Debug, PartialEq)]
28+
#[derive(Error, Debug, PartialEq, Eq)]
2929
#[error("Decimal256 range exceeded")]
3030
pub struct Decimal256RangeExceeded;
3131

0 commit comments

Comments
 (0)