diff --git a/Cargo.toml b/Cargo.toml index d1950edf0f..7d453e7913 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ homepage = "https://www.nushell.sh" license = "MIT" name = "nu" repository = "https://github.com/nushell/nushell" -rust-version = "1.82.0" +rust-version = "1.83.0" version = "0.102.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/nu-command/src/filesystem/cd.rs b/crates/nu-command/src/filesystem/cd.rs index c4f540010e..d8e6713199 100644 --- a/crates/nu-command/src/filesystem/cd.rs +++ b/crates/nu-command/src/filesystem/cd.rs @@ -77,7 +77,9 @@ impl Command for Cd { if let Ok(path) = nu_path::canonicalize_with(path_no_whitespace, &cwd) { if !path.is_dir() { return Err(shell_error::io::IoError::new( - shell_error::io::ErrorKind::NotADirectory, + shell_error::io::ErrorKind::Std( + std::io::ErrorKind::NotADirectory, + ), v.span, None, ) @@ -104,7 +106,7 @@ impl Command for Cd { }; if !path.is_dir() { return Err(shell_error::io::IoError::new( - shell_error::io::ErrorKind::NotADirectory, + shell_error::io::ErrorKind::Std(std::io::ErrorKind::NotADirectory), v.span, path, ) diff --git a/crates/nu-command/src/filesystem/open.rs b/crates/nu-command/src/filesystem/open.rs index f1ea73c6c8..2be2314835 100644 --- a/crates/nu-command/src/filesystem/open.rs +++ b/crates/nu-command/src/filesystem/open.rs @@ -151,7 +151,7 @@ impl Command for Open { // At least under windows this check ensures that we don't get a // permission denied error on directories return Err(ShellError::Io(IoError::new( - shell_error::io::ErrorKind::IsADirectory, + shell_error::io::ErrorKind::Std(std::io::ErrorKind::IsADirectory), arg_span, PathBuf::from(path), ))); diff --git a/crates/nu-command/src/filesystem/save.rs b/crates/nu-command/src/filesystem/save.rs index bd580eec8c..1cbf75373f 100644 --- a/crates/nu-command/src/filesystem/save.rs +++ b/crates/nu-command/src/filesystem/save.rs @@ -424,7 +424,9 @@ fn open_file(path: &Path, span: Span, append: bool) -> Result // A TOCTOU problem exists here, which may cause wrong error message to be shown #[cfg(target_os = "windows")] if path.is_dir() { - Err(nu_protocol::shell_error::io::ErrorKind::IsADirectory) + Err(nu_protocol::shell_error::io::ErrorKind::Std( + std::io::ErrorKind::IsADirectory, + )) } else { std::fs::File::create(path).map_err(|err| err.kind().into()) } diff --git a/crates/nu-command/tests/commands/database/into_sqlite.rs b/crates/nu-command/tests/commands/database/into_sqlite.rs index 5c0f5f6c60..856757e768 100644 --- a/crates/nu-command/tests/commands/database/into_sqlite.rs +++ b/crates/nu-command/tests/commands/database/into_sqlite.rs @@ -405,7 +405,7 @@ impl From for Value { } } -impl<'r> TryFrom<&rusqlite::Row<'r>> for TestRow { +impl TryFrom<&rusqlite::Row<'_>> for TestRow { type Error = rusqlite::Error; fn try_from(row: &rusqlite::Row) -> Result { diff --git a/crates/nu-command/tests/commands/rm.rs b/crates/nu-command/tests/commands/rm.rs index 3bfc093bd0..ca3b367a34 100644 --- a/crates/nu-command/tests/commands/rm.rs +++ b/crates/nu-command/tests/commands/rm.rs @@ -419,7 +419,7 @@ fn set_dir_read_only(directory: &AbsolutePath, read_only: bool) { } #[cfg(not(windows))] -impl<'a> Drop for Cleanup<'a> { +impl Drop for Cleanup<'_> { /// Restores write permissions to the given directory so that the Playground can be successfully /// cleaned up. fn drop(&mut self) { diff --git a/crates/nu-explore/src/views/record/table_widget.rs b/crates/nu-explore/src/views/record/table_widget.rs index 9f56702d0b..39ff34b4ec 100644 --- a/crates/nu-explore/src/views/record/table_widget.rs +++ b/crates/nu-explore/src/views/record/table_widget.rs @@ -87,7 +87,7 @@ impl StatefulWidget for TableWidget<'_> { } // todo: refactoring these to methods as they have quite a bit in common. -impl<'a> TableWidget<'a> { +impl TableWidget<'_> { // header at the top; header is always 1 line fn render_table_horizontal(self, area: Rect, buf: &mut Buffer, state: &mut TableWidgetState) { let padding_l = self.config.column_padding_left as u16; diff --git a/crates/nu-protocol/src/errors/shell_error/io.rs b/crates/nu-protocol/src/errors/shell_error/io.rs index 83836bff73..71b9726bc0 100644 --- a/crates/nu-protocol/src/errors/shell_error/io.rs +++ b/crates/nu-protocol/src/errors/shell_error/io.rs @@ -132,11 +132,7 @@ pub struct IoError { #[derive(Debug, Clone, Copy, PartialEq, Eq, Diagnostic)] pub enum ErrorKind { Std(std::io::ErrorKind), - // TODO: in Rust 1.83 this can be std::io::ErrorKind::NotADirectory - NotADirectory, NotAFile, - // TODO: in Rust 1.83 this can be std::io::ErrorKind::IsADirectory - IsADirectory, } #[derive(Debug, Clone, PartialEq, Eq, Error, Diagnostic)] @@ -321,9 +317,7 @@ impl Display for ErrorKind { let (first, rest) = msg.split_at(1); write!(f, "{}{}", first.to_uppercase(), rest) } - ErrorKind::NotADirectory => write!(f, "Not a directory"), ErrorKind::NotAFile => write!(f, "Not a file"), - ErrorKind::IsADirectory => write!(f, "Is a directory"), } } } @@ -357,9 +351,7 @@ impl Diagnostic for IoError { std::io::ErrorKind::Other => code.push_str("other"), kind => code.push_str(&kind.to_string().to_lowercase().replace(" ", "_")), }, - ErrorKind::NotADirectory => code.push_str("not_a_directory"), ErrorKind::NotAFile => code.push_str("not_a_file"), - ErrorKind::IsADirectory => code.push_str("is_a_directory"), } Some(Box::new(code)) diff --git a/crates/nu_plugin_query/src/query_webpage_info.rs b/crates/nu_plugin_query/src/query_webpage_info.rs index 74a7be94c3..2c8bb4de23 100644 --- a/crates/nu_plugin_query/src/query_webpage_info.rs +++ b/crates/nu_plugin_query/src/query_webpage_info.rs @@ -302,7 +302,7 @@ impl<'a> MapSerializer<'a> { } } -impl<'a> serde::ser::SerializeStruct for MapSerializer<'a> { +impl serde::ser::SerializeStruct for MapSerializer<'_> { type Ok = Value; type Error = Error; @@ -320,7 +320,7 @@ impl<'a> serde::ser::SerializeStruct for MapSerializer<'a> { } } -impl<'a> serde::ser::SerializeMap for MapSerializer<'a> { +impl serde::ser::SerializeMap for MapSerializer<'_> { type Ok = Value; type Error = Error; @@ -351,7 +351,7 @@ impl<'a> serde::ser::SerializeMap for MapSerializer<'a> { } } -impl<'a> serde::ser::SerializeStructVariant for MapSerializer<'a> { +impl serde::ser::SerializeStructVariant for MapSerializer<'_> { type Ok = Value; type Error = Error; @@ -385,7 +385,7 @@ impl<'a> SeqSerializer<'a> { } } -impl<'a> serde::ser::SerializeSeq for SeqSerializer<'a> { +impl serde::ser::SerializeSeq for SeqSerializer<'_> { type Ok = Value; type Error = Error; @@ -402,7 +402,7 @@ impl<'a> serde::ser::SerializeSeq for SeqSerializer<'a> { } } -impl<'a> serde::ser::SerializeTuple for SeqSerializer<'a> { +impl serde::ser::SerializeTuple for SeqSerializer<'_> { type Ok = Value; type Error = Error; @@ -419,7 +419,7 @@ impl<'a> serde::ser::SerializeTuple for SeqSerializer<'a> { } } -impl<'a> serde::ser::SerializeTupleStruct for SeqSerializer<'a> { +impl serde::ser::SerializeTupleStruct for SeqSerializer<'_> { type Ok = Value; type Error = Error; @@ -436,7 +436,7 @@ impl<'a> serde::ser::SerializeTupleStruct for SeqSerializer<'a> { } } -impl<'a> serde::ser::SerializeTupleVariant for SeqSerializer<'a> { +impl serde::ser::SerializeTupleVariant for SeqSerializer<'_> { type Ok = Value; type Error = Error; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 3c1ce2370b..2f6272a99b 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -16,4 +16,4 @@ profile = "default" # use in nushell, we may opt to use the bleeding edge stable version of rust. # I believe rust is on a 6 week release cycle and nushell is on a 4 week release cycle. # So, every two nushell releases, this version number should be bumped by one. -channel = "1.82.0" +channel = "1.83.0" diff --git a/tests/repl/test_config_path.rs b/tests/repl/test_config_path.rs index 29c090db17..8ed90f913a 100644 --- a/tests/repl/test_config_path.rs +++ b/tests/repl/test_config_path.rs @@ -78,9 +78,9 @@ fn run_interactive_stderr(xdg_config_home: impl AsRef) -> String { .output() .expect("Should have outputted"); - return String::from_utf8_lossy(&child_output.stderr) + String::from_utf8_lossy(&child_output.stderr) .trim() - .to_string(); + .to_string() } fn test_config_path_helper(