Skip to content

Commit 922cbc3

Browse files
committed
made clippy happy
1 parent 0b2c28b commit 922cbc3

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/dotfiles.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,7 @@ impl TryFrom<path::PathBuf> for Dotfile {
165165

166166
// returns Some if group ends with a valid target platform suffix or custom target
167167
pub fn get_group_target(group: &str) -> Option<&str> {
168-
let Some(potential_target) = group.split('_').next_back() else {
169-
return None;
170-
};
168+
let potential_target = group.split('_').next_back()?;
171169

172170
// a custom target would look like my_group_#target
173171
(potential_target.starts_with('#')
@@ -179,7 +177,7 @@ pub fn group_without_target(group: &str) -> &str {
179177
let Some(target) = get_group_target(group) else {
180178
return group;
181179
};
182-
&group
180+
group
183181
.strip_suffix(target)
184182
.expect("group has target")
185183
.trim_end_matches('_')
@@ -347,9 +345,7 @@ pub fn get_potential_dotfiles_paths(profile: Option<String>) -> PotentialDotfile
347345
PotentialDotfilePaths {
348346
home: dirs::home_dir().unwrap().join(format!(".{dotfiles_dir}")),
349347
config: dirs::config_dir().unwrap().join(dotfiles_dir),
350-
env: std::env::var("TUCKR_HOME")
351-
.map(|home| PathBuf::from(home))
352-
.ok(),
348+
env: std::env::var("TUCKR_HOME").map(PathBuf::from).ok(),
353349
test: std::env::temp_dir()
354350
.join(format!("tuckr-{}", std::thread::current().name().unwrap()))
355351
.join("dotfiles"),
@@ -379,7 +375,7 @@ pub fn get_dotfiles_path(profile: Option<String>) -> Result<path::PathBuf, Strin
379375
if let Some(dotfiles) = env_dotfiles
380376
&& dotfiles.exists()
381377
{
382-
Ok(dotfiles.into())
378+
Ok(dotfiles)
383379
} else if config_dotfiles.exists() {
384380
Ok(config_dotfiles)
385381
} else if home_dotfiles.exists() {

0 commit comments

Comments
 (0)