Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
hansieodendaal committed Sep 17, 2024
1 parent 370d47d commit 759bf68
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 4 additions & 9 deletions applications/minotari_node/src/grpc_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::{fmt, str::FromStr};
use serde::{Deserialize, Serialize};

/// A list of all the GRPC methods that can be enabled/disabled
#[derive(Debug, Clone, Copy, Serialize, Deserialize, Eq, PartialEq)]
#[derive(Default, Debug, Clone, Copy, Serialize, Deserialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum GrpcMethod {
ListHeaders,
Expand All @@ -35,6 +35,7 @@ pub enum GrpcMethod {
GetConstants,
GetBlockSize,
GetBlockFees,
#[default]
GetVersion,
CheckForUpdates,
GetTokensInCirculation,
Expand Down Expand Up @@ -66,12 +67,6 @@ pub enum GrpcMethod {
GetSideChainUtxos,
}

impl Default for GrpcMethod {
fn default() -> Self {
GrpcMethod::GetVersion
}
}

impl GrpcMethod {
/// All the GRPC methods as a fixed array
pub const ALL_VARIANTS: [GrpcMethod; 36] = [
Expand Down Expand Up @@ -223,7 +218,7 @@ mod tests {
#[test]
fn grpc_method_into_iter_is_exhaustive() {
let mut count = 0;
for method in GrpcMethod::ALL_VARIANTS.iter() {
for method in &GrpcMethod::ALL_VARIANTS {
match method {
GrpcMethod::ListHeaders => count += 1,
GrpcMethod::GetHeaderByHash => count += 1,
Expand Down Expand Up @@ -269,7 +264,7 @@ mod tests {
#[test]
fn it_converts_from_serde_json_str_to_enum() {
// Iterate over all the enum variants and convert them to a string
for method in GrpcMethod::ALL_VARIANTS.iter() {
for method in &GrpcMethod::ALL_VARIANTS {
let method_str = serde_json::to_string(&method).unwrap();
let method_from_str = GrpcMethod::from_str(&method_str).unwrap();
assert_eq!(method, &method_from_str);
Expand Down
2 changes: 2 additions & 0 deletions common/src/configuration/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ pub fn load_configuration<P: AsRef<Path>, TOverride: ConfigOverrideProvider>(
);
write_config_to(&config_path, &sources)
.map_err(|io| ConfigError::new("Could not create default config", Some(io.to_string())))?;
} else {
// Nothing here
}

load_configuration_with_overrides(config_path, overrides, cli_network)
Expand Down

0 comments on commit 759bf68

Please sign in to comment.