Skip to content

Commit dd0530c

Browse files
committed
Fix: cargo clippy --fix (11 to 5)
1 parent 41df945 commit dd0530c

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/core/builtins/type_.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn type_no_opt_sub(core: &mut ShellCore, com: &String) -> i32 {
3636
}
3737

3838
let s = format!("{}: not found", &com);
39-
return super::error_exit(1, "type", &s, core);
39+
super::error_exit(1, "type", &s, core)
4040
}
4141

4242
fn type_no_opt(core: &mut ShellCore, args: &[String]) -> i32 {
@@ -117,7 +117,7 @@ fn type_p_sub(core: &mut ShellCore, com: &String) -> i32 {
117117
return 0;
118118
}
119119

120-
if let Ok(path) = core.db.get_elem("BASH_CMDS", &com) {
120+
if let Ok(path) = core.db.get_elem("BASH_CMDS", com) {
121121
if !path.is_empty() {
122122
println!("{}", &path);
123123
return 0;

src/elements/command/simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ impl SimpleCommand {
197197
fn set_environment_variables(&mut self, core: &mut ShellCore) -> Result<(), ExecError> {
198198
let layer = core.db.get_layer_num() - 1;
199199
for (k, v) in &mut core.db.params[layer] {
200-
env::set_var(&k, v.get_as_single().unwrap_or("".to_string()));
200+
env::set_var(k, v.get_as_single().unwrap_or("".to_string()));
201201
}
202202
Ok(())
203203
}

src/elements/substitution/value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl Value {
169169
}
170170
let txt = "'".to_owned() + &a.text + "'";
171171
let mut w = Word::from(txt.as_str());
172-
return self.reparse_word(&mut w, core);
172+
self.reparse_word(&mut w, core)
173173
}
174174
ParsedDataType::None => Ok(()),
175175
}

src/utils/arg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub fn dissolve_option(opt: &str) -> Vec<String> {
6363
if opt.starts_with("--") {
6464
vec![opt.to_string()]
6565
} else if let Some(stripped) = opt.strip_prefix('-') {
66-
if stripped == "" {
66+
if stripped.is_empty() {
6767
return vec!["-".to_string()];
6868
}
6969

@@ -72,7 +72,7 @@ pub fn dissolve_option(opt: &str) -> Vec<String> {
7272
.map(|c| ("-".to_owned() + &c.to_string()).to_string())
7373
.collect()
7474
} else if let Some(stripped) = opt.strip_prefix('+') {
75-
if stripped == "" {
75+
if stripped.is_empty() {
7676
return vec!["+".to_string()];
7777
}
7878

0 commit comments

Comments
 (0)