Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: address new clippy 0.1.51 warnings #364

Merged
merged 6 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/houston/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
6 changes: 3 additions & 3 deletions crates/houston/src/profile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion crates/rover-client/src/blocking/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions crates/rover-client/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -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}")]
Expand Down
1 change: 1 addition & 0 deletions crates/rover-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions crates/sputnik/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion installers/binstall/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/command/core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/command/graph/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ impl Fetch {
&client,
)?;

Ok(RoverStdout::SDL(sdl))
Ok(RoverStdout::Sdl(sdl))
}
}
8 changes: 4 additions & 4 deletions src/command/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>),
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/command/subgraph/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ impl Fetch {
&self.subgraph,
)?;

Ok(RoverStdout::SDL(sdl))
Ok(RoverStdout::Sdl(sdl))
}
}
6 changes: 3 additions & 3 deletions src/error/metadata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<RoverClientError>() {
let (suggestion, code) = match rover_client_error {
RoverClientError::InvalidJSON(_)
RoverClientError::InvalidJson(_)
| RoverClientError::InvalidHeaderName(_)
| RoverClientError::InvalidHeaderValue(_)
| RoverClientError::SendRequest(_)
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down