diff --git a/Cargo.toml b/Cargo.toml index e120fc90c9..8db830be13 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.86.0" +rust-version = "1.87.0" version = "0.106.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -203,6 +203,7 @@ webpki-roots = "1.0" # todo = "warn" unchecked_duration_subtraction = "warn" used_underscore_binding = "warn" +result_large_err = "allow" [lints] workspace = true diff --git a/crates/nu-command/src/filters/default.rs b/crates/nu-command/src/filters/default.rs index d20f9ae97c..c0e33112af 100644 --- a/crates/nu-command/src/filters/default.rs +++ b/crates/nu-command/src/filters/default.rs @@ -236,7 +236,7 @@ fn default( /// A wrapper around the default value to handle closures and caching values enum DefaultValue { - Uncalculated(Spanned), + Uncalculated(Box>), Calculated(Value), } @@ -258,7 +258,7 @@ impl DefaultValue { match value { Value::Closure { val, .. } => { let closure_eval = ClosureEval::new(engine_state, stack, *val); - DefaultValue::Uncalculated(closure_eval.into_spanned(span)) + DefaultValue::Uncalculated(Box::new(closure_eval.into_spanned(span))) } _ => DefaultValue::Calculated(value), } diff --git a/crates/nu-command/src/network/http/timeout_extractor_reader.rs b/crates/nu-command/src/network/http/timeout_extractor_reader.rs index 548e0b00ea..635c316796 100644 --- a/crates/nu-command/src/network/http/timeout_extractor_reader.rs +++ b/crates/nu-command/src/network/http/timeout_extractor_reader.rs @@ -28,7 +28,7 @@ impl Read for UreqTimeoutExtractorReader { std::io::Error::new(std::io::ErrorKind::TimedOut, ureq_err) } // package it back - e => std::io::Error::new(std::io::ErrorKind::Other, e), + e => std::io::Error::other(e), } }) } diff --git a/crates/nu-command/src/strings/split/list.rs b/crates/nu-command/src/strings/split/list.rs index 303737ae0a..0d492f5638 100644 --- a/crates/nu-command/src/strings/split/list.rs +++ b/crates/nu-command/src/strings/split/list.rs @@ -210,7 +210,7 @@ impl Command for SubCommand { enum Matcher { Regex(Regex), Direct(Value), - Closure(ClosureEval), + Closure(Box), } enum Split { @@ -257,7 +257,7 @@ impl Matcher { } pub fn from_closure(closure: ClosureEval) -> Self { - Self::Closure(closure) + Self::Closure(Box::new(closure)) } pub fn compare(&mut self, rhs: &Value) -> Result { diff --git a/crates/nu-glob/src/lib.rs b/crates/nu-glob/src/lib.rs index ff83987da1..8709aaf245 100644 --- a/crates/nu-glob/src/lib.rs +++ b/crates/nu-glob/src/lib.rs @@ -1259,8 +1259,7 @@ mod test { .ok() .map(|p| match p.components().next().unwrap() { Component::Prefix(prefix_component) => { - let path = Path::new(prefix_component.as_os_str()).join("*"); - path + Path::new(prefix_component.as_os_str()).join("*") } _ => panic!("no prefix in this path"), }) diff --git a/crates/nu-json/src/de.rs b/crates/nu-json/src/de.rs index 43a5174ff1..64985651af 100644 --- a/crates/nu-json/src/de.rs +++ b/crates/nu-json/src/de.rs @@ -2,16 +2,16 @@ //! //! This module provides for Hjson deserialization with the type `Deserializer`. -use std::char; -use std::io; -use std::marker::PhantomData; -use std::str; - -use serde::de; - use super::error::{Error, ErrorCode, Result}; use super::util::StringReader; use super::util::{Number, ParseNumber}; +use serde::de; +use std::{ + char, io, + io::{BufReader, Read}, + marker::PhantomData, + str, +}; enum State { Normal, @@ -804,7 +804,10 @@ where R: io::Read, T: de::DeserializeOwned, { - from_iter(rdr.bytes()) + // Use a buffered reader so that calling `.bytes()` is efficient and + // doesn't trigger clippy's `unbuffered_bytes` lint when the input + // comes from a non-memory source. + from_iter(BufReader::new(rdr).bytes()) } /// Decodes a Hjson value from a byte slice `&[u8]`. diff --git a/crates/nu-system/src/windows.rs b/crates/nu-system/src/windows.rs index 28ec5986e6..86016c3f4b 100644 --- a/crates/nu-system/src/windows.rs +++ b/crates/nu-system/src/windows.rs @@ -757,7 +757,7 @@ fn get_proc_env(params: &T, handle: HANDLE) -> Vec< let mut begin = 0; while let Some(offset) = raw_env[begin..].iter().position(|&c| c == 0) { let end = begin + offset; - if raw_env[begin..end].iter().any(|&c| c == equals) { + if raw_env[begin..end].contains(&equals) { result.push( OsString::from_wide(&raw_env[begin..end]) .to_string_lossy() diff --git a/crates/nu_plugin_custom_values/src/cool_custom_value.rs b/crates/nu_plugin_custom_values/src/cool_custom_value.rs index 634f716717..7e316ab485 100644 --- a/crates/nu_plugin_custom_values/src/cool_custom_value.rs +++ b/crates/nu_plugin_custom_values/src/cool_custom_value.rs @@ -1,3 +1,4 @@ +#![allow(clippy::result_large_err)] use nu_protocol::{ CustomValue, ShellError, Span, Type, Value, ast::{self, Math, Operator}, diff --git a/crates/nu_plugin_custom_values/src/second_custom_value.rs b/crates/nu_plugin_custom_values/src/second_custom_value.rs index fde02cfade..becb4d287d 100644 --- a/crates/nu_plugin_custom_values/src/second_custom_value.rs +++ b/crates/nu_plugin_custom_values/src/second_custom_value.rs @@ -1,7 +1,7 @@ -use std::cmp::Ordering; - +#![allow(clippy::result_large_err)] use nu_protocol::{CustomValue, ShellError, Span, Value}; use serde::{Deserialize, Serialize}; +use std::cmp::Ordering; #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)] pub struct SecondCustomValue { diff --git a/crates/nu_plugin_polars/src/lib.rs b/crates/nu_plugin_polars/src/lib.rs index 9612ddabbd..412f3071b9 100644 --- a/crates/nu_plugin_polars/src/lib.rs +++ b/crates/nu_plugin_polars/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(clippy::result_large_err)] use std::{ cmp::Ordering, panic::{AssertUnwindSafe, catch_unwind}, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index d6a3ec5155..5f22158dbb 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -14,4 +14,4 @@ profile = "default" # so that we give repo maintainers and package managers a chance to update to a more # recent version of rust. However, if there is a "cool new feature" that we want to # use in nushell, we may opt to use the bleeding edge stable version of rust. -channel = "1.86.0" +channel = "1.87.0"