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

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
lostman committed Oct 6, 2023
1 parent d052e53 commit 9e46ac2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions packages/fuel-indexer-lib/src/graphql/schema_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ use std::collections::HashMap;
// TWO
// THREE
// }
fn decode_enum(types: &Vec<TypeDeclaration>, ty: &TypeDeclaration) -> Option<String> {
fn decode_enum(types: &[TypeDeclaration], ty: &TypeDeclaration) -> Option<String> {
let name = ty.type_field.strip_prefix("enum ").unwrap();

let mut fields: Vec<String> = vec![];
if let Some(ref components) = ty.components {
for c in components {
let ty = &types.get(c.type_id)?;
if is_unit_type(ty) {
fields.push(format!("{}", c.name.to_uppercase()));
fields.push(c.name.to_uppercase().to_string());
} else {
return None;
}
Expand All @@ -52,7 +52,7 @@ fn decode_enum(types: &Vec<TypeDeclaration>, ty: &TypeDeclaration) -> Option<Str
// Given a `TypeDeclaration` for an ABI struct, generate a corresponding GraphQL `type`.
fn decode_struct(
scalar_types: &HashMap<&str, &str>,
abi_types: &Vec<TypeDeclaration>,
abi_types: &[TypeDeclaration],
ty: &TypeDeclaration,
) -> Option<String> {
let name = ty.type_field.strip_prefix("struct ")?;
Expand Down Expand Up @@ -104,7 +104,7 @@ fn decode_struct(
}

// Generate a GraphQL schema from JSON ABI.
pub fn generate_schema(json_abi: &std::path::PathBuf) -> Option<String> {
pub fn generate_schema(json_abi: &std::path::Path) -> Option<String> {
let source = fuels_code_gen::utils::Source::parse(json_abi.to_str()?).unwrap();
let source = source.get().unwrap();
let abi: ProgramABI = serde_json::from_str(&source).unwrap();
Expand Down
16 changes: 8 additions & 8 deletions packages/fuel-indexer-types/src/fuel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl From<ClientInput> for Input {
amount: message_signed.amount,
nonce: message_signed.nonce,
witness_index: message_signed.witness_index,
data: message_signed.data.into(),
data: message_signed.data,
predicate: "".into(),
predicate_data: "".into(),
})
Expand All @@ -228,9 +228,9 @@ impl From<ClientInput> for Input {
amount: message_predicate.amount,
nonce: message_predicate.nonce,
witness_index: 0,
data: message_predicate.data.into(),
predicate: message_predicate.predicate.into(),
predicate_data: message_predicate.predicate_data.into(),
data: message_predicate.data,
predicate: message_predicate.predicate,
predicate_data: message_predicate.predicate_data,
})
}
ClientInput::CoinSigned(coin_signed) => Input::Coin(InputCoin {
Expand All @@ -252,8 +252,8 @@ impl From<ClientInput> for Input {
tx_pointer: coin_predicate.tx_pointer.into(),
witness_index: 0,
maturity: coin_predicate.maturity,
predicate: coin_predicate.predicate.into(),
predicate_data: coin_predicate.predicate_data.into(),
predicate: coin_predicate.predicate,
predicate_data: coin_predicate.predicate_data,
}),
ClientInput::Contract(contract) => Input::Contract(InputContract {
utxo_id: contract.utxo_id,
Expand Down Expand Up @@ -282,8 +282,8 @@ impl From<ClientInput> for Input {
nonce: message_coin.nonce,
witness_index: 0,
data: "".into(),
predicate: message_coin.predicate.into(),
predicate_data: message_coin.predicate_data.into(),
predicate: message_coin.predicate,
predicate_data: message_coin.predicate_data,
})
}
}
Expand Down

0 comments on commit 9e46ac2

Please sign in to comment.