Skip to content

Commit

Permalink
[graphql/rpc] chore: cleanup clippy (MystenLabs#14693)
Browse files Browse the repository at this point in the history
## Description 

Cleanup clippy overrides

## 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
  • Loading branch information
oxade authored Nov 7, 2023
1 parent 1a7c4ab commit 70d283a
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 32 deletions.
2 changes: 0 additions & 2 deletions crates/sui-graphql-rpc/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ impl Default for Limits {
}
}

#[allow(dead_code)]
#[derive(Serialize, Clone, Deserialize, Debug, Eq, PartialEq)]
pub struct InternalFeatureConfig {
#[serde(default)]
Expand Down Expand Up @@ -239,7 +238,6 @@ pub struct ServerConfig {
pub ide: Ide,
}

#[allow(dead_code)]
impl ServerConfig {
pub fn from_yaml(path: &str) -> Result<Self, SuiGraphQLError> {
let contents = std::fs::read_to_string(path).map_err(|e| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2051,7 +2051,6 @@ impl From<&TransactionKind> for TransactionBlockKind {
}

// TODO fix this GenesisObject
#[allow(unreachable_code)]
impl From<GenesisObject> for SuiAddress {
fn from(value: GenesisObject) -> Self {
match value {
Expand Down
1 change: 0 additions & 1 deletion crates/sui-graphql-rpc/src/server/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub struct Server {
pub server: HyperServer<HyperAddrIncoming, IntoMakeServiceWithConnectInfo<Router, SocketAddr>>,
}

#[allow(dead_code)]
impl Server {
pub async fn run(self) -> Result<(), Error> {
get_or_init_server_start_time().await;
Expand Down
3 changes: 0 additions & 3 deletions crates/sui-graphql-rpc/src/types/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ pub(crate) enum AddressTransactionBlockRelationship {
Paid, // Transactions that were paid for by this address
}

#[allow(clippy::diverging_sub_expression)]
#[allow(unreachable_code)]
#[allow(unused_variables)]
#[Object]
impl Address {
/// Similar behavior to the `transactionBlockConnection` in Query but
Expand Down
2 changes: 0 additions & 2 deletions crates/sui-graphql-rpc/src/types/move_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ pub(crate) struct MoveModule {

/// Represents a module in Move, a library that defines struct types
/// and functions that operate on these types.
#[allow(unreachable_code)]
#[allow(unused_variables)]
#[Object]
impl MoveModule {
async fn file_format_version(&self) -> u32 {
Expand Down
6 changes: 1 addition & 5 deletions crates/sui-graphql-rpc/src/types/move_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ pub(crate) struct MoveObject {
pub native_object: NativeSuiObject,
}

#[allow(unreachable_code)]
#[allow(unused_variables)]
#[Object]
impl MoveObject {
/// Displays the contents of the MoveObject in a json string and through graphql types
/// Also provides the flat representation of the type signature, and the bcs of the corresponding data
async fn contents(&self, ctx: &Context<'_>) -> Result<Option<MoveValue>> {
let resolver = ctx.data_unchecked::<PgManager>();

async fn contents(&self) -> Result<Option<MoveValue>> {
if let Some(struct_tag) = self.native_object.data.struct_tag() {
let type_tag = TypeTag::Struct(Box::new(struct_tag));
return Ok(Some(MoveValue::new(
Expand Down
3 changes: 0 additions & 3 deletions crates/sui-graphql-rpc/src/types/move_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ struct TypeOrigin {
defining_id: SuiAddress,
}

#[allow(unreachable_code)]
#[allow(unused_variables)]
#[Object]
impl MovePackage {
/// A representation of the module called `name` in this package, including the
Expand All @@ -75,7 +73,6 @@ impl MovePackage {
/// Paginate through the MoveModules defined in this package.
pub async fn module_connection(
&self,
ctx: &Context<'_>,
first: Option<u64>,
after: Option<String>,
last: Option<u64>,
Expand Down
3 changes: 0 additions & 3 deletions crates/sui-graphql-rpc/src/types/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ pub(crate) struct ObjectKey {
version: u64,
}

#[allow(clippy::diverging_sub_expression)]
#[allow(unreachable_code)]
#[allow(unused_variables)]
#[Object]
impl Object {
async fn version(&self) -> u64 {
Expand Down
1 change: 0 additions & 1 deletion crates/sui-graphql-rpc/src/types/object_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use super::object::Object;
use async_graphql::SimpleObject;

#[derive(PartialEq, Eq, Clone, SimpleObject)]
#[allow(dead_code)]
pub(crate) struct ObjectChange {
pub input_state: Option<Object>,
pub output_state: Option<Object>,
Expand Down
9 changes: 3 additions & 6 deletions crates/sui-graphql-rpc/src/types/owner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,24 @@ pub(crate) struct Owner {
pub address: SuiAddress,
}

#[allow(clippy::diverging_sub_expression)]
#[allow(unreachable_code)]
#[allow(unused_variables)]
#[Object]
impl Owner {
async fn as_address(&self, ctx: &Context<'_>) -> Option<Address> {
async fn as_address(&self) -> Option<Address> {
// For now only addresses can be owners
Some(Address {
address: self.address,
})
}

async fn as_object(&self, ctx: &Context<'_>) -> Option<Object> {
async fn as_object(&self) -> Option<Object> {
// TODO: extend when send to object imnplementation is done
// For now only addresses can be owners
None
}

// =========== Owner interface methods =============

pub async fn location(&self, ctx: &Context<'_>) -> SuiAddress {
pub async fn location(&self) -> SuiAddress {
self.address
}

Expand Down
4 changes: 1 addition & 3 deletions crates/sui-graphql-rpc/src/types/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ use crate::{
pub(crate) struct Query;
pub(crate) type SuiGraphQLSchema = async_graphql::Schema<Query, EmptyMutation, EmptySubscription>;

#[allow(unreachable_code)]
#[allow(unused_variables)]
#[Object]
impl Query {
/// First four bytes of the network's genesis checkpoint digest (uniquely identifies the
Expand Down Expand Up @@ -55,7 +53,7 @@ impl Query {
// dryRunTransactionBlock
// coinMetadata

async fn owner(&self, ctx: &Context<'_>, address: SuiAddress) -> Option<ObjectOwner> {
async fn owner(&self, address: SuiAddress) -> Option<ObjectOwner> {
Some(ObjectOwner::Owner(Owner { address }))
}

Expand Down
1 change: 0 additions & 1 deletion crates/sui-graphql-rpc/src/types/sui_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ impl ScalarType for SuiAddress {
}

impl SuiAddress {
#[allow(dead_code)]
pub fn into_array(self) -> [u8; SUI_ADDRESS_LENGTH] {
self.0
}
Expand Down
1 change: 0 additions & 1 deletion crates/sui-graphql-rpc/src/types/transaction_block_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::context_data::db_data_provider::PgManager;
use async_graphql::{ComplexObject, Context, Result, ResultExt, SimpleObject, Union};

#[derive(Union, PartialEq, Clone, Eq)]
#[allow(clippy::enum_variant_names)]
pub(crate) enum TransactionBlockKind {
ConsensusCommitPrologueTransaction(ConsensusCommitPrologueTransaction),
GenesisTransaction(GenesisTransaction),
Expand Down

0 comments on commit 70d283a

Please sign in to comment.