Skip to content

Commit 1ea45dc

Browse files
committed
chore: rust 1.89
1 parent 713b75a commit 1ea45dc

File tree

8 files changed

+18
-24
lines changed

8 files changed

+18
-24
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.85.0"
2+
channel = "1.89.0"
33
components = ["clippy", "rustfmt"]

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#![deny(clippy::print_stderr)]
44
#![deny(clippy::print_stdout)]
55
#![deny(clippy::unused_async)]
6+
#![allow(mismatched_lifetime_syntaxes)]
67

78
pub mod parser;
89

src/parser.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,10 @@ fn parse_unquoted_word(input: &str) -> ParseResult<Vec<WordPart>> {
651651
result
652652
.ok()
653653
.map(|(_, parts)| {
654-
if parts.len() == 1 {
655-
if let WordPart::Text(text) = &parts[0] {
654+
if parts.len() == 1
655+
&& let WordPart::Text(text) = &parts[0] {
656656
return !is_reserved_word(text);
657657
}
658-
}
659658
true
660659
})
661660
.unwrap_or(true)
@@ -1041,13 +1040,12 @@ fn assert_whitespace_or_end_and_skip(input: &str) -> ParseResult<()> {
10411040
}
10421041

10431042
fn assert_whitespace_or_end(input: &str) -> ParseResult<()> {
1044-
if let Some(next_char) = input.chars().next() {
1045-
if !next_char.is_whitespace()
1043+
if let Some(next_char) = input.chars().next()
1044+
&& !next_char.is_whitespace()
10461045
&& !matches!(next_char, ';' | '&' | '|' | '(' | ')')
10471046
{
10481047
return Err(ParseError::Failure(fail_for_trailing_input(input)));
10491048
}
1050-
}
10511049
Ok((input, ()))
10521050
}
10531051

src/shell/child_process_tracker.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@ impl ChildProcessTracker {
3939
}
4040

4141
pub fn track(&self, child: &Child) {
42-
if let Err(err) = self.0.track(child) {
43-
if cfg!(debug_assertions) && child.id().is_some() {
42+
if let Err(err) = self.0.track(child)
43+
&& cfg!(debug_assertions) && child.id().is_some() {
4444
panic!("Could not track process: {:#}", err);
4545
}
46-
}
4746
}
4847
}
4948

src/shell/command.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ enum CommandName {
8080

8181
struct ResolvedCommand<'a> {
8282
command_name: CommandName,
83-
args: Cow<'a, Vec<OsString>>,
83+
args: Cow<'a, [OsString]>,
8484
}
8585

8686
#[derive(Error, Debug)]
@@ -111,7 +111,7 @@ impl FailedShebangError {
111111
async fn resolve_command<'a>(
112112
command_name: &UnresolvedCommandName,
113113
context: &ShellCommandContext,
114-
original_args: &'a Vec<OsString>,
114+
original_args: &'a [OsString],
115115
) -> Result<ResolvedCommand<'a>, ResolveCommandError> {
116116
let command_path = match resolve_command_path(
117117
&command_name.name,
@@ -125,8 +125,8 @@ async fn resolve_command<'a>(
125125
// only bother checking for a shebang when the path has a slash
126126
// in it because for global commands someone on Windows likely
127127
// won't have a script with a shebang in it on Windows
128-
if Path::new(&command_name.name).components().count() > 1 {
129-
if let Some(shebang) = resolve_shebang(&command_path).map_err(|err| {
128+
if Path::new(&command_name.name).components().count() > 1
129+
&& let Some(shebang) = resolve_shebang(&command_path).map_err(|err| {
130130
ResolveCommandError::FailedShebang(FailedShebangError::Any(err.into()))
131131
})? {
132132
let (shebang_command_name, mut args) = if shebang.string_split {
@@ -150,7 +150,6 @@ async fn resolve_command<'a>(
150150
args: Cow::Owned(args),
151151
});
152152
}
153-
}
154153

155154
Ok(ResolvedCommand {
156155
command_name: CommandName::Resolved(command_path),

src/shell/commands/rm.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,14 @@ async fn execute_remove(cwd: &Path, args: &[OsString]) -> Result<()> {
6262
} else {
6363
remove_file_or_dir(&path, &flags).await
6464
};
65-
if let Err(err) = result {
66-
if err.kind() != ErrorKind::NotFound || !flags.force {
65+
if let Err(err) = result
66+
&& (err.kind() != ErrorKind::NotFound || !flags.force) {
6767
bail!(
6868
"cannot remove '{}': {}",
6969
specified_path.to_string_lossy(),
7070
err
7171
);
7272
}
73-
}
7473
}
7574

7675
Ok(())

src/shell/commands/xargs.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,10 @@ fn xargs_collect_args(
6666
args.extend(text.split(delimiter).map(|t| t.into()));
6767

6868
// remove last arg if it is empty
69-
if let Some(last) = args.last() {
70-
if last.is_empty() {
69+
if let Some(last) = args.last()
70+
&& last.is_empty() {
7171
args.pop();
7272
}
73-
}
7473
} else {
7574
args.extend(delimit_blanks(&text)?);
7675
}

src/shell/types.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,14 @@ impl ShellState {
150150
};
151151
if name == "PWD" {
152152
let cwd = Path::new(value);
153-
if cwd.is_absolute() {
154-
if let Ok(cwd) = deno_path_util::fs::canonicalize_path_maybe_not_exists(
153+
if cwd.is_absolute()
154+
&& let Ok(cwd) = deno_path_util::fs::canonicalize_path_maybe_not_exists(
155155
&sys_traits::impls::RealSys,
156156
cwd,
157157
) {
158158
// this will update the environment variable too
159159
self.set_cwd(cwd);
160160
}
161-
}
162161
} else {
163162
self.shell_vars.remove(&name);
164163
self.env_vars.insert(name, value.to_os_string());

0 commit comments

Comments
 (0)