Skip to content

Commit c0e0eb2

Browse files
committed
fixes
1 parent 7d6eee7 commit c0e0eb2

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "1.89.0"
2+
channel = "1.92.0"
33
components = ["clippy", "rustfmt"]

src/shell/commands/shopt.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,23 @@ impl ShellCommand for ShoptCommand {
2020
let mut set_mode = None; // None = query, Some(true) = -s, Some(false) = -u
2121
let mut options_to_change = Vec::new();
2222

23-
let mut args = context.args.into_iter().peekable();
24-
while let Some(arg) = args.next() {
23+
for arg in context.args.into_iter().peekable() {
2524
let arg_str = arg.to_string_lossy();
2625
match arg_str.as_ref() {
2726
"-s" => {
2827
if set_mode == Some(false) {
29-
let _ = context
30-
.stderr
31-
.write_line("shopt: cannot set and unset options simultaneously");
28+
let _ = context.stderr.write_line(
29+
"shopt: cannot set and unset options simultaneously",
30+
);
3231
return ExecuteResult::from_exit_code(1);
3332
}
3433
set_mode = Some(true);
3534
}
3635
"-u" => {
3736
if set_mode == Some(true) {
38-
let _ = context
39-
.stderr
40-
.write_line("shopt: cannot set and unset options simultaneously");
37+
let _ = context.stderr.write_line(
38+
"shopt: cannot set and unset options simultaneously",
39+
);
4140
return ExecuteResult::from_exit_code(1);
4241
}
4342
set_mode = Some(false);
@@ -47,9 +46,10 @@ impl ShellCommand for ShoptCommand {
4746
match parse_option_name(&arg_str) {
4847
Some(opt) => options_to_change.push(opt),
4948
None => {
50-
let _ = context
51-
.stderr
52-
.write_line(&format!("shopt: {}: invalid shell option name", arg_str));
49+
let _ = context.stderr.write_line(&format!(
50+
"shopt: {}: invalid shell option name",
51+
arg_str
52+
));
5353
return ExecuteResult::from_exit_code(1);
5454
}
5555
}
@@ -104,9 +104,11 @@ impl ShellCommand for ShoptCommand {
104104
any_off = true;
105105
}
106106
let name = option_to_name(opt);
107-
let _ = context
108-
.stdout
109-
.write_line(&format!("{}\t{}", name, if is_on { "on" } else { "off" }));
107+
let _ = context.stdout.write_line(&format!(
108+
"{}\t{}",
109+
name,
110+
if is_on { "on" } else { "off" }
111+
));
110112
}
111113
ExecuteResult::from_exit_code(if any_off { 1 } else { 0 })
112114
}

0 commit comments

Comments
 (0)