diff --git a/crates/houston/src/error.rs b/crates/houston/src/error.rs index e319fdf9c..92dc2d3ad 100644 --- a/crates/houston/src/error.rs +++ b/crates/houston/src/error.rs @@ -48,7 +48,7 @@ pub enum HoustonProblem { #[error(transparent)] TomlDeserialization(#[from] toml::de::Error), - /// IOError occurs when any given std::io::Error arises. + /// IoError occurs when any given std::io::Error arises. #[error(transparent)] - IOError(#[from] io::Error), + IoError(#[from] io::Error), } diff --git a/crates/houston/src/profile/mod.rs b/crates/houston/src/profile/mod.rs index 32e39ae3e..e9ec56458 100644 --- a/crates/houston/src/profile/mod.rs +++ b/crates/houston/src/profile/mod.rs @@ -119,10 +119,10 @@ impl Profile { pub fn delete(name: &str, config: &Config) -> Result<(), HoustonProblem> { let dir = Profile::dir(name, config); tracing::debug!(dir = ?dir); - Ok(fs::remove_dir_all(dir).map_err(|e| match e.kind() { + fs::remove_dir_all(dir).map_err(|e| match e.kind() { io::ErrorKind::NotFound => HoustonProblem::ProfileNotFound(name.to_string()), - _ => HoustonProblem::IOError(e), - })?) + _ => HoustonProblem::IoError(e), + }) } /// Lists profiles based on directories in `$APOLLO_CONFIG_HOME/profiles` diff --git a/crates/rover-client/src/blocking/client.rs b/crates/rover-client/src/blocking/client.rs index 096169de0..e49c61a3e 100644 --- a/crates/rover-client/src/blocking/client.rs +++ b/crates/rover-client/src/blocking/client.rs @@ -59,7 +59,7 @@ impl Client { return Err(RoverClientError::MalformedKey); } - return Err(RoverClientError::GraphQL { + return Err(RoverClientError::GraphQl { msg: errs .into_iter() .map(|err| err.message) diff --git a/crates/rover-client/src/error.rs b/crates/rover-client/src/error.rs index 175ddf011..e43fb85d3 100644 --- a/crates/rover-client/src/error.rs +++ b/crates/rover-client/src/error.rs @@ -5,7 +5,7 @@ use thiserror::Error; pub enum RoverClientError { /// The provided GraphQL was invalid. #[error("{msg}")] - GraphQL { + GraphQl { /// The encountered GraphQL error. msg: String, }, @@ -27,7 +27,7 @@ pub enum RoverClientError { /// Invalid JSON in response body. #[error("could not parse JSON")] - InvalidJSON(#[from] serde_json::Error), + InvalidJson(#[from] serde_json::Error), /// Encountered an error handling the received response. #[error("{msg}")] diff --git a/crates/rover-client/src/lib.rs b/crates/rover-client/src/lib.rs index b220f0cc2..2a4ad7ecd 100644 --- a/crates/rover-client/src/lib.rs +++ b/crates/rover-client/src/lib.rs @@ -16,6 +16,7 @@ pub mod introspection; pub use error::RoverClientError; /// Module for actually querying studio +#[allow(clippy::upper_case_acronyms)] pub mod query; /// Module for getting release info diff --git a/crates/sputnik/src/error.rs b/crates/sputnik/src/error.rs index 1ec6cc581..382cf9b2e 100644 --- a/crates/sputnik/src/error.rs +++ b/crates/sputnik/src/error.rs @@ -5,25 +5,25 @@ use std::io; /// SputnikError is the type of Error that occured. #[derive(Error, Debug)] pub enum SputnikError { - /// IOError occurs when any given std::io::Error arises. + /// IoError occurs when any given std::io::Error arises. #[error(transparent)] - IOError(#[from] io::Error), + IoError(#[from] io::Error), - /// JSONError occurs when an error occurs when serializing/deserializing JSON. + /// JsonError occurs when an error occurs when serializing/deserializing JSON. #[error(transparent)] - JSONError(#[from] serde_json::Error), + JsonError(#[from] serde_json::Error), - /// HTTPError occurs when an error occurs while reporting anonymous usage data. + /// HttpError occurs when an error occurs while reporting anonymous usage data. #[error("Could not report anonymous usage data.")] - HTTPError(#[from] reqwest::Error), + HttpError(#[from] reqwest::Error), /// VersionParseError occurs when the version of the tool cannot be determined. #[error("Could not parse the version of the tool.")] VersionParseError(#[from] semver::SemVerError), - /// URLParseError occurs when the URL to POST the anonymous usage data cannot be parsed. + /// UrlParseError occurs when the URL to POST the anonymous usage data cannot be parsed. #[error("Could not parse telemetry URL.")] - URLParseError(#[from] url::ParseError), + UrlParseError(#[from] url::ParseError), /// ConfigError occurs when the configuration location of the globally persistent machine /// identifier cannot be found. diff --git a/installers/binstall/src/error.rs b/installers/binstall/src/error.rs index 34efa7c3f..dcee54fc6 100644 --- a/installers/binstall/src/error.rs +++ b/installers/binstall/src/error.rs @@ -6,7 +6,7 @@ use std::io; #[derive(Error, Debug)] pub enum InstallerError { #[error(transparent)] - IOError(#[from] io::Error), + IoError(#[from] io::Error), #[error("Could not find the home directory of the current user")] NoHomeUnix, diff --git a/src/command/core/build.rs b/src/command/core/build.rs index 52bf1d338..265c25ccc 100644 --- a/src/command/core/build.rs +++ b/src/command/core/build.rs @@ -21,7 +21,7 @@ impl Build { let subgraph_definitions = core_config.get_subgraph_definitions(&self.config_path)?; match harmonizer::harmonize(subgraph_definitions) { - Ok(csdl) => Ok(RoverStdout::CSDL(csdl)), + Ok(csdl) => Ok(RoverStdout::Csdl(csdl)), Err(composition_errors) => { let num_failures = composition_errors.len(); for composition_error in composition_errors { diff --git a/src/command/graph/fetch.rs b/src/command/graph/fetch.rs index 3381fa0e6..d3d4c1e38 100644 --- a/src/command/graph/fetch.rs +++ b/src/command/graph/fetch.rs @@ -42,6 +42,6 @@ impl Fetch { &client, )?; - Ok(RoverStdout::SDL(sdl)) + Ok(RoverStdout::Sdl(sdl)) } } diff --git a/src/command/output.rs b/src/command/output.rs index bd57e6fb4..5a4cb9a2d 100644 --- a/src/command/output.rs +++ b/src/command/output.rs @@ -17,8 +17,8 @@ use crate::utils::table::{self, cell, row}; #[derive(Clone, PartialEq, Debug)] pub enum RoverStdout { DocsList(HashMap<&'static str, &'static str>), - SDL(String), - CSDL(String), + Sdl(String), + Csdl(String), SchemaHash(String), SubgraphList(ListDetails), VariantList(Vec), @@ -44,11 +44,11 @@ impl RoverStdout { } println!("{}", table); } - RoverStdout::SDL(sdl) => { + RoverStdout::Sdl(sdl) => { eprintln!("SDL:"); println!("{}", &sdl); } - RoverStdout::CSDL(csdl) => { + RoverStdout::Csdl(csdl) => { eprintln!("CSDL:"); println!("{}", &csdl); } diff --git a/src/command/subgraph/fetch.rs b/src/command/subgraph/fetch.rs index 769da0954..e51ae6bc1 100644 --- a/src/command/subgraph/fetch.rs +++ b/src/command/subgraph/fetch.rs @@ -48,6 +48,6 @@ impl Fetch { &self.subgraph, )?; - Ok(RoverStdout::SDL(sdl)) + Ok(RoverStdout::Sdl(sdl)) } } diff --git a/src/error/metadata/mod.rs b/src/error/metadata/mod.rs index b23f19749..48f18c748 100644 --- a/src/error/metadata/mod.rs +++ b/src/error/metadata/mod.rs @@ -38,7 +38,7 @@ impl From<&mut anyhow::Error> for Metadata { fn from(error: &mut anyhow::Error) -> Self { if let Some(rover_client_error) = error.downcast_ref::() { let (suggestion, code) = match rover_client_error { - RoverClientError::InvalidJSON(_) + RoverClientError::InvalidJson(_) | RoverClientError::InvalidHeaderName(_) | RoverClientError::InvalidHeaderValue(_) | RoverClientError::SendRequest(_) @@ -72,7 +72,7 @@ impl From<&mut anyhow::Error> for Metadata { (Some(Suggestion::CheckGraphNameAndAuth), None) } RoverClientError::AdhocError { msg: _ } - | RoverClientError::GraphQL { msg: _ } + | RoverClientError::GraphQl { msg: _ } | RoverClientError::IntrospectionError { msg: _ } => (None, None), RoverClientError::InvalidKey => (Some(Suggestion::CheckKey), None), RoverClientError::MalformedKey => (Some(Suggestion::ProperKey), None), @@ -109,7 +109,7 @@ impl From<&mut anyhow::Error> for Metadata { | HoustonProblem::PathNotUnicode { path_display: _ } | HoustonProblem::TomlDeserialization(_) | HoustonProblem::TomlSerialization(_) - | HoustonProblem::IOError(_) => (Some(Suggestion::SubmitIssue), None), + | HoustonProblem::IoError(_) => (Some(Suggestion::SubmitIssue), None), }; return Metadata { suggestion, diff --git a/src/utils/git.rs b/src/utils/git.rs index 4d51bed20..48b4ffd37 100644 --- a/src/utils/git.rs +++ b/src/utils/git.rs @@ -132,54 +132,54 @@ impl GitContext { } type GraphPublishContextInput = graph::publish::publish_schema_mutation::GitContextInput; -impl Into for GitContext { - fn into(self) -> GraphPublishContextInput { +impl From for GraphPublishContextInput { + fn from(git_context: GitContext) -> GraphPublishContextInput { GraphPublishContextInput { - branch: self.branch, - commit: self.commit, - committer: self.author, - remote_url: self.remote_url, - message: self.message, + branch: git_context.branch, + commit: git_context.commit, + committer: git_context.author, + remote_url: git_context.remote_url, + message: git_context.message, } } } type GraphCheckContextInput = graph::check::check_schema_query::GitContextInput; -impl Into for GitContext { - fn into(self) -> GraphCheckContextInput { +impl From for GraphCheckContextInput { + fn from(git_context: GitContext) -> GraphCheckContextInput { GraphCheckContextInput { - branch: self.branch, - commit: self.commit, - committer: self.author, - remote_url: self.remote_url, - message: self.message, + branch: git_context.branch, + commit: git_context.commit, + committer: git_context.author, + remote_url: git_context.remote_url, + message: git_context.message, } } } type SubgraphPublishContextInput = subgraph::publish::publish_partial_schema_mutation::GitContextInput; -impl Into for GitContext { - fn into(self) -> SubgraphPublishContextInput { +impl From for SubgraphPublishContextInput { + fn from(git_context: GitContext) -> SubgraphPublishContextInput { SubgraphPublishContextInput { - branch: self.branch, - commit: self.commit, - committer: self.author, - remote_url: self.remote_url, - message: self.message, + branch: git_context.branch, + commit: git_context.commit, + committer: git_context.author, + remote_url: git_context.remote_url, + message: git_context.message, } } } type SubgraphCheckContextInput = subgraph::check::check_partial_schema_query::GitContextInput; -impl Into for GitContext { - fn into(self) -> SubgraphCheckContextInput { +impl From for SubgraphCheckContextInput { + fn from(git_context: GitContext) -> SubgraphCheckContextInput { SubgraphCheckContextInput { - branch: self.branch, - commit: self.commit, - committer: self.author, - remote_url: self.remote_url, - message: self.message, + branch: git_context.branch, + commit: git_context.commit, + committer: git_context.author, + remote_url: git_context.remote_url, + message: git_context.message, } } }