Skip to content

Commit 9b51c9b

Browse files
authored
bump rust-toolchain to 1.89 (nushell#16958)
This PR bumps the rust toolchain to 1.89 since 1.91 was released today. ## Release notes summary - What our users need to know N/A ## Tasks after submitting N/A
1 parent 18953d5 commit 9b51c9b

File tree

12 files changed

+116
-118
lines changed

12 files changed

+116
-118
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ homepage = "https://www.nushell.sh"
1010
license = "MIT"
1111
name = "nu"
1212
repository = "https://github.com/nushell/nushell"
13-
rust-version = "1.88.0"
13+
rust-version = "1.89.0"
1414
version = "0.108.1"
1515

1616
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

crates/nu-cli/src/commands/history/history_import.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ fn find_backup_path(path: &Path, span: Span) -> Result<PathBuf, ShellError> {
261261
for i in 1..100 {
262262
use std::fmt::Write;
263263
bak_path.truncate(base_len);
264-
write!(&mut bak_path, ".{i}").unwrap();
264+
write!(&mut bak_path, ".{i}").ok();
265265
if !Path::new(&bak_path).exists() {
266266
return Ok(PathBuf::from(bak_path));
267267
}

crates/nu-cmd-extra/src/extra/formats/to/html.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ fn to_html(
310310
.get("foreground")
311311
.expect("Error getting foreground color")
312312
)
313-
.unwrap();
313+
.ok();
314314
} else {
315315
write!(
316316
&mut output_string,
@@ -322,7 +322,7 @@ fn to_html(
322322
.get("foreground")
323323
.expect("Error getting foreground color")
324324
)
325-
.unwrap();
325+
.ok();
326326
}
327327

328328
let inner_value = match vec_of_values.len() {

crates/nu-command/src/strings/ansi/ansi_.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -963,10 +963,10 @@ mod tests {
963963
let mut duplicates = Vec::new();
964964

965965
for ansi in CODE_LIST.iter() {
966-
if let Some(name) = ansi.short_name {
967-
if !seen.insert(name) {
968-
duplicates.push(name);
969-
}
966+
if let Some(name) = ansi.short_name
967+
&& !seen.insert(name)
968+
{
969+
duplicates.push(name);
970970
}
971971
}
972972

crates/nu-command/src/system/which_.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -305,23 +305,23 @@ mod windows {
305305
impl IsExecutable for Path {
306306
fn is_executable(&self) -> bool {
307307
// Check using file extension
308-
if let Some(pathext) = std::env::var_os("PATHEXT") {
309-
if let Some(extension) = self.extension() {
310-
let extension = extension.to_string_lossy();
311-
312-
// Originally taken from:
313-
// https://github.com/nushell/nushell/blob/93e8f6c05e1e1187d5b674d6b633deb839c84899/crates/nu-cli/src/completion/command.rs#L64-L74
314-
return pathext
315-
.to_string_lossy()
316-
.split(';')
317-
// Filter out empty tokens and ';' at the end
318-
.filter(|f| f.len() > 1)
319-
.any(|ext| {
320-
// Cut off the leading '.' character
321-
let ext = &ext[1..];
322-
extension.eq_ignore_ascii_case(ext)
323-
});
324-
}
308+
if let Some(pathext) = std::env::var_os("PATHEXT")
309+
&& let Some(extension) = self.extension()
310+
{
311+
let extension = extension.to_string_lossy();
312+
313+
// Originally taken from:
314+
// https://github.com/nushell/nushell/blob/93e8f6c05e1e1187d5b674d6b633deb839c84899/crates/nu-cli/src/completion/command.rs#L64-L74
315+
return pathext
316+
.to_string_lossy()
317+
.split(';')
318+
// Filter out empty tokens and ';' at the end
319+
.filter(|f| f.len() > 1)
320+
.any(|ext| {
321+
// Cut off the leading '.' character
322+
let ext = &ext[1..];
323+
extension.eq_ignore_ascii_case(ext)
324+
});
325325
}
326326

327327
// Check using file properties
@@ -331,10 +331,10 @@ mod windows {
331331

332332
let result =
333333
unsafe { GetBinaryTypeW(PCWSTR(windows_string.as_ptr()), &mut binary_type) };
334-
if result.is_ok() {
335-
if let 0..=6 = binary_type {
336-
return true;
337-
}
334+
if result.is_ok()
335+
&& let 0..=6 = binary_type
336+
{
337+
return true;
338338
}
339339

340340
false

crates/nu-explore/src/explore_regex.rs

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -355,69 +355,69 @@ fn run_app_loop(
355355
loop {
356356
terminal.draw(|f| draw_ui(f, app))?;
357357

358-
if let Event::Key(key) = event::read()? {
359-
if key.kind == KeyEventKind::Press {
360-
// Handle Ctrl+Q to quit
361-
if key.code == KeyCode::Char('q')
362-
&& key
363-
.modifiers
364-
.contains(crossterm::event::KeyModifiers::CONTROL)
365-
{
366-
return Ok(());
367-
}
358+
if let Event::Key(key) = event::read()?
359+
&& key.kind == KeyEventKind::Press
360+
{
361+
// Handle Ctrl+Q to quit
362+
if key.code == KeyCode::Char('q')
363+
&& key
364+
.modifiers
365+
.contains(crossterm::event::KeyModifiers::CONTROL)
366+
{
367+
return Ok(());
368+
}
368369

369-
// Handle Tab to switch focus.
370-
if matches!(key.code, KeyCode::Tab | KeyCode::BackTab) {
371-
app.input_focus = match app.input_focus {
372-
InputFocus::Regex => InputFocus::Sample,
373-
InputFocus::Sample => InputFocus::Regex,
374-
};
375-
continue;
376-
}
370+
// Handle Tab to switch focus.
371+
if matches!(key.code, KeyCode::Tab | KeyCode::BackTab) {
372+
app.input_focus = match app.input_focus {
373+
InputFocus::Regex => InputFocus::Sample,
374+
InputFocus::Sample => InputFocus::Regex,
375+
};
376+
continue;
377+
}
377378

378-
// Escape will focus the Regex field back again.
379-
if matches!(key.code, KeyCode::Esc) {
380-
app.input_focus = InputFocus::Regex;
381-
continue;
382-
}
379+
// Escape will focus the Regex field back again.
380+
if matches!(key.code, KeyCode::Esc) {
381+
app.input_focus = InputFocus::Regex;
382+
continue;
383+
}
383384

384-
// Intercept PageUp/PageDown in Sample pane to move by one page height
385-
if matches!(app.input_focus, InputFocus::Sample) {
386-
match key.code {
387-
KeyCode::PageUp | KeyCode::PageDown => {
388-
let page = std::cmp::max(app.sample_view_height, 1);
389-
let (row, col) = app.sample_textarea.cursor();
390-
let rows_len = app.sample_textarea.lines().len();
391-
let target_row_u16 = match key.code {
392-
KeyCode::PageUp => (row as u16).saturating_sub(page),
393-
KeyCode::PageDown => {
394-
let max_row = rows_len.saturating_sub(1) as u16;
395-
let r = (row as u16).saturating_add(page);
396-
if r > max_row { max_row } else { r }
397-
}
398-
_ => row as u16,
399-
};
400-
let target_col_u16 = col as u16;
401-
app.sample_textarea
402-
.move_cursor(CursorMove::Jump(target_row_u16, target_col_u16));
403-
continue;
404-
}
405-
_ => {}
385+
// Intercept PageUp/PageDown in Sample pane to move by one page height
386+
if matches!(app.input_focus, InputFocus::Sample) {
387+
match key.code {
388+
KeyCode::PageUp | KeyCode::PageDown => {
389+
let page = std::cmp::max(app.sample_view_height, 1);
390+
let (row, col) = app.sample_textarea.cursor();
391+
let rows_len = app.sample_textarea.lines().len();
392+
let target_row_u16 = match key.code {
393+
KeyCode::PageUp => (row as u16).saturating_sub(page),
394+
KeyCode::PageDown => {
395+
let max_row = rows_len.saturating_sub(1) as u16;
396+
let r = (row as u16).saturating_add(page);
397+
if r > max_row { max_row } else { r }
398+
}
399+
_ => row as u16,
400+
};
401+
let target_col_u16 = col as u16;
402+
app.sample_textarea
403+
.move_cursor(CursorMove::Jump(target_row_u16, target_col_u16));
404+
continue;
406405
}
406+
_ => {}
407407
}
408+
}
408409

409-
// Convert crossterm event to tui-textarea input
410-
let input = Input::from(Event::Key(key));
410+
// Convert crossterm event to tui-textarea input
411+
let input = Input::from(Event::Key(key));
411412

412-
// Handle input based on current mode
413-
match app.input_focus {
414-
InputFocus::Regex => {
415-
app.regex_textarea.input(input);
416-
app.compile_regex(); // TODO: Do this in a worker thread.
417-
}
418-
InputFocus::Sample => {
419-
app.sample_textarea.input(input);
420-
}
413+
// Handle input based on current mode
414+
match app.input_focus {
415+
InputFocus::Regex => {
416+
app.regex_textarea.input(input);
417+
app.compile_regex(); // TODO: Do this in a worker thread.
418+
}
419+
InputFocus::Sample => {
420+
app.sample_textarea.input(input);
421421
}
422422
}
423423
}

crates/nu-parser/tests/test_parser.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,12 +1807,13 @@ mod string {
18071807
assert_eq!(pipeline.len(), 1);
18081808
let element = &pipeline.elements[0];
18091809
assert!(element.redirection.is_none());
1810-
if let Expr::ExternalCall(_, args) = &element.expr.expr {
1811-
if let [ExternalArgument::Regular(expr)] = args.as_ref() {
1812-
assert_eq!(expr.expr, Expr::RawString("text".into()));
1813-
return;
1814-
}
1810+
if let Expr::ExternalCall(_, args) = &element.expr.expr
1811+
&& let [ExternalArgument::Regular(expr)] = args.as_ref()
1812+
{
1813+
assert_eq!(expr.expr, Expr::RawString("text".into()));
1814+
return;
18151815
}
1816+
18161817
panic!("wrong expression: {:?}", element.expr.expr)
18171818
}
18181819
}

crates/nu-plugin/src/plugin/interface/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,9 +1107,6 @@ fn set_pgrp_from_enter_foreground(pgrp: i64) -> Result<(), ShellError> {
11071107
#[cfg(not(unix))]
11081108
fn set_pgrp_from_enter_foreground(_pgrp: i64) -> Result<(), ShellError> {
11091109
Err(ShellError::NushellFailed {
1110-
msg: concat!(
1111-
"EnterForeground asked plugin to join process group, but this is not supported on non UNIX platforms.",
1112-
)
1113-
.into(),
1110+
msg: "EnterForeground asked plugin to join process group, but this is not supported on non UNIX platforms.".to_string(),
11141111
})
11151112
}

crates/nu-system/src/macos.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,21 @@ pub fn collect_proc(interval: Duration, _with_thread: bool) -> Vec<ProcessInfo>
7373
let fds = listpidinfo::<ListFDs>(pid, curr_task.pbsd.pbi_nfiles as usize);
7474
if let Ok(fds) = fds {
7575
for fd in fds {
76-
if let ProcFDType::Socket = fd.proc_fdtype.into() {
77-
if let Ok(socket) = pidfdinfo::<SocketFDInfo>(pid, fd.proc_fd) {
78-
match socket.psi.soi_kind.into() {
79-
SocketInfoKind::In => {
80-
if socket.psi.soi_protocol == libc::IPPROTO_UDP {
81-
let info = unsafe { socket.psi.soi_proto.pri_in };
82-
curr_udps.push(info);
83-
}
76+
if let ProcFDType::Socket = fd.proc_fdtype.into()
77+
&& let Ok(socket) = pidfdinfo::<SocketFDInfo>(pid, fd.proc_fd)
78+
{
79+
match socket.psi.soi_kind.into() {
80+
SocketInfoKind::In => {
81+
if socket.psi.soi_protocol == libc::IPPROTO_UDP {
82+
let info = unsafe { socket.psi.soi_proto.pri_in };
83+
curr_udps.push(info);
8484
}
85-
SocketInfoKind::Tcp => {
86-
let info = unsafe { socket.psi.soi_proto.pri_tcp };
87-
curr_tcps.push(info);
88-
}
89-
_ => (),
9085
}
86+
SocketInfoKind::Tcp => {
87+
let info = unsafe { socket.psi.soi_proto.pri_tcp };
88+
curr_tcps.push(info);
89+
}
90+
_ => (),
9191
}
9292
}
9393
}
@@ -199,11 +199,11 @@ fn get_path_info(pid: i32, mut size: size_t) -> Option<PathInfo> {
199199
.to_owned();
200200
let mut need_root = true;
201201
let mut root = Default::default();
202-
if exe.is_absolute() {
203-
if let Some(parent) = exe.parent() {
204-
root = parent.to_path_buf();
205-
need_root = false;
206-
}
202+
if exe.is_absolute()
203+
&& let Some(parent) = exe.parent()
204+
{
205+
root = parent.to_path_buf();
206+
need_root = false;
207207
}
208208
while cp < ptr.add(size) && *cp == 0 {
209209
cp = cp.offset(1);

crates/nu-table/tests/style.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,12 @@ fn test_light() {
309309

310310
assert_eq!(
311311
create_table(vec![row(4); 1], true, theme::light()),
312-
concat!(" 0 1 2 3 ")
312+
" 0 1 2 3 "
313313
);
314314

315315
assert_eq!(
316316
create_table(vec![row(4); 1], false, theme::light()),
317-
concat!(" 0 1 2 3 ")
317+
" 0 1 2 3 "
318318
);
319319

320320
assert_eq!(
@@ -339,12 +339,12 @@ fn test_none() {
339339

340340
assert_eq!(
341341
create_table(vec![row(4); 1], true, theme::none()),
342-
concat!(" 0 1 2 3 ")
342+
" 0 1 2 3 "
343343
);
344344

345345
assert_eq!(
346346
create_table(vec![row(4); 1], false, theme::none()),
347-
concat!(" 0 1 2 3 ")
347+
" 0 1 2 3 "
348348
);
349349

350350
assert_eq!(

0 commit comments

Comments
 (0)