Skip to content

Commit 83a743a

Browse files
authored
chore: update for clippy warnings (#267)
1 parent aaca7a9 commit 83a743a

File tree

5 files changed

+15
-311
lines changed

5 files changed

+15
-311
lines changed

crates/houston/src/profile/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ pub struct Opts {
2727
}
2828

2929
impl Profile {
30-
fn base_dir(config: &Config) -> Result<PathBuf, HoustonProblem> {
31-
Ok(config.home.join("profiles"))
30+
fn base_dir(config: &Config) -> PathBuf {
31+
config.home.join("profiles")
3232
}
3333

34-
fn dir(name: &str, config: &Config) -> Result<PathBuf, HoustonProblem> {
35-
Ok(Profile::base_dir(config)?.join(name))
34+
fn dir(name: &str, config: &Config) -> PathBuf {
35+
Profile::base_dir(config).join(name)
3636
}
3737

3838
/// Writes an api_key to the filesystem (`$APOLLO_CONFIG_HOME/profiles/<profile_name>/.sensitive`).
@@ -73,7 +73,7 @@ impl Profile {
7373
/// Loads and deserializes configuration from the file system for a
7474
/// specific profile.
7575
pub fn load(name: &str, config: &Config, opts: LoadOpts) -> Result<Profile, HoustonProblem> {
76-
if Profile::dir(name, config)?.exists() {
76+
if Profile::dir(name, config).exists() {
7777
if opts.sensitive {
7878
let sensitive = Sensitive::load(name, config)?;
7979
return Ok(Profile { sensitive });
@@ -86,7 +86,7 @@ impl Profile {
8686

8787
/// Deletes profile data from file system.
8888
pub fn delete(name: &str, config: &Config) -> Result<(), HoustonProblem> {
89-
let dir = Profile::dir(name, config)?;
89+
let dir = Profile::dir(name, config);
9090
tracing::debug!(dir = ?dir);
9191
Ok(fs::remove_dir_all(dir).map_err(|e| match e.kind() {
9292
std::io::ErrorKind::NotFound => HoustonProblem::ProfileNotFound(name.to_string()),
@@ -96,7 +96,7 @@ impl Profile {
9696

9797
/// Lists profiles based on directories in `$APOLLO_CONFIG_HOME/profiles`
9898
pub fn list(config: &Config) -> Result<Vec<String>, HoustonProblem> {
99-
let profiles_dir = Profile::base_dir(config)?;
99+
let profiles_dir = Profile::base_dir(config);
100100
let mut profiles = vec![];
101101

102102
// if profiles dir doesn't exist return empty vec

crates/houston/src/profile/sensitive.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ pub struct Sensitive {
1212
}
1313

1414
impl Sensitive {
15-
fn path(profile_name: &str, config: &Config) -> Result<PathBuf, HoustonProblem> {
16-
Ok(Profile::dir(profile_name, config)?.join(".sensitive"))
15+
fn path(profile_name: &str, config: &Config) -> PathBuf {
16+
Profile::dir(profile_name, config).join(".sensitive")
1717
}
1818

1919
/// Serializes to toml and saves to file system at `$APOLLO_CONFIG_HOME/<profile_name>/.sensitive`.
2020
pub fn save(&self, profile_name: &str, config: &Config) -> Result<(), HoustonProblem> {
21-
let path = Sensitive::path(profile_name, config)?;
21+
let path = Sensitive::path(profile_name, config);
2222
let data = toml::to_string(self)?;
2323

2424
if let Some(dirs) = &path.parent() {
@@ -32,7 +32,7 @@ impl Sensitive {
3232

3333
/// Opens and deserializes `$APOLLO_CONFIG_HOME/<profile_name>/.sensitive`.
3434
pub fn load(profile_name: &str, config: &Config) -> Result<Sensitive, HoustonProblem> {
35-
let path = Sensitive::path(profile_name, config)?;
35+
let path = Sensitive::path(profile_name, config);
3636
let data = fs::read_to_string(&path)?;
3737
tracing::debug!(path = ?path, data_len = ?data.len());
3838
Ok(toml::from_str(&data)?)

installers/npm/package-lock.json

+1-297
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/command/config/auth.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ mod tests {
7373
fn it_can_set_default_api_key() {
7474
let config = get_config(None);
7575

76-
Profile::set_api_key(DEFAULT_PROFILE, &config, DEFAULT_KEY.into()).unwrap();
76+
Profile::set_api_key(DEFAULT_PROFILE, &config, DEFAULT_KEY).unwrap();
7777
let result = Profile::get_api_key(DEFAULT_PROFILE, &config).unwrap();
7878
assert_eq!(result, DEFAULT_KEY);
7979
}
@@ -83,7 +83,7 @@ mod tests {
8383
fn it_can_set_custom_api_key() {
8484
let config = get_config(None);
8585

86-
Profile::set_api_key(CUSTOM_PROFILE, &config, CUSTOM_KEY.into()).unwrap();
86+
Profile::set_api_key(CUSTOM_PROFILE, &config, CUSTOM_KEY).unwrap();
8787
let result = Profile::get_api_key(CUSTOM_PROFILE, &config).unwrap();
8888
assert_eq!(result, CUSTOM_KEY);
8989
}

0 commit comments

Comments
 (0)