update to rust version 1.87.0 (#16437)

The PR upgrades nushell to rust version 1.87.0.

## Dev overview from clippy
- I added `result_large_err` to clippy in the root Cargo.toml to avoid
the warnings (and a few places in plugins). At some point a more proper
fix, perhaps boxing these, will need to be performed. This PR is to just
get us over the hump.
- I boxed a couple areas in some commands
- I changed `rdr.bytes()` to `BufReader::new(rdr).bytes()` in nu-json

## Release notes summary - What our users need to know
Users can use rust version 1.87.0 to compile nushell now

## Tasks after submitting
N/A
This commit is contained in:
Darren Schroeder
2025-08-14 11:27:34 -05:00
committed by GitHub
parent daf52ba5c8
commit 36427a7434
11 changed files with 25 additions and 20 deletions

View File

@@ -10,7 +10,7 @@ homepage = "https://www.nushell.sh"
license = "MIT" license = "MIT"
name = "nu" name = "nu"
repository = "https://github.com/nushell/nushell" repository = "https://github.com/nushell/nushell"
rust-version = "1.86.0" rust-version = "1.87.0"
version = "0.106.2" version = "0.106.2"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # 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" # todo = "warn"
unchecked_duration_subtraction = "warn" unchecked_duration_subtraction = "warn"
used_underscore_binding = "warn" used_underscore_binding = "warn"
result_large_err = "allow"
[lints] [lints]
workspace = true workspace = true

View File

@@ -236,7 +236,7 @@ fn default(
/// A wrapper around the default value to handle closures and caching values /// A wrapper around the default value to handle closures and caching values
enum DefaultValue { enum DefaultValue {
Uncalculated(Spanned<ClosureEval>), Uncalculated(Box<Spanned<ClosureEval>>),
Calculated(Value), Calculated(Value),
} }
@@ -258,7 +258,7 @@ impl DefaultValue {
match value { match value {
Value::Closure { val, .. } => { Value::Closure { val, .. } => {
let closure_eval = ClosureEval::new(engine_state, stack, *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), _ => DefaultValue::Calculated(value),
} }

View File

@@ -28,7 +28,7 @@ impl<R: Read> Read for UreqTimeoutExtractorReader<R> {
std::io::Error::new(std::io::ErrorKind::TimedOut, ureq_err) std::io::Error::new(std::io::ErrorKind::TimedOut, ureq_err)
} }
// package it back // package it back
e => std::io::Error::new(std::io::ErrorKind::Other, e), e => std::io::Error::other(e),
} }
}) })
} }

View File

@@ -210,7 +210,7 @@ impl Command for SubCommand {
enum Matcher { enum Matcher {
Regex(Regex), Regex(Regex),
Direct(Value), Direct(Value),
Closure(ClosureEval), Closure(Box<ClosureEval>),
} }
enum Split { enum Split {
@@ -257,7 +257,7 @@ impl Matcher {
} }
pub fn from_closure(closure: ClosureEval) -> Self { pub fn from_closure(closure: ClosureEval) -> Self {
Self::Closure(closure) Self::Closure(Box::new(closure))
} }
pub fn compare(&mut self, rhs: &Value) -> Result<bool, ShellError> { pub fn compare(&mut self, rhs: &Value) -> Result<bool, ShellError> {

View File

@@ -1259,8 +1259,7 @@ mod test {
.ok() .ok()
.map(|p| match p.components().next().unwrap() { .map(|p| match p.components().next().unwrap() {
Component::Prefix(prefix_component) => { Component::Prefix(prefix_component) => {
let path = Path::new(prefix_component.as_os_str()).join("*"); Path::new(prefix_component.as_os_str()).join("*")
path
} }
_ => panic!("no prefix in this path"), _ => panic!("no prefix in this path"),
}) })

View File

@@ -2,16 +2,16 @@
//! //!
//! This module provides for Hjson deserialization with the type `Deserializer`. //! 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::error::{Error, ErrorCode, Result};
use super::util::StringReader; use super::util::StringReader;
use super::util::{Number, ParseNumber}; use super::util::{Number, ParseNumber};
use serde::de;
use std::{
char, io,
io::{BufReader, Read},
marker::PhantomData,
str,
};
enum State { enum State {
Normal, Normal,
@@ -804,7 +804,10 @@ where
R: io::Read, R: io::Read,
T: de::DeserializeOwned, 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]`. /// Decodes a Hjson value from a byte slice `&[u8]`.

View File

@@ -757,7 +757,7 @@ fn get_proc_env<T: RtlUserProcessParameters>(params: &T, handle: HANDLE) -> Vec<
let mut begin = 0; let mut begin = 0;
while let Some(offset) = raw_env[begin..].iter().position(|&c| c == 0) { while let Some(offset) = raw_env[begin..].iter().position(|&c| c == 0) {
let end = begin + offset; let end = begin + offset;
if raw_env[begin..end].iter().any(|&c| c == equals) { if raw_env[begin..end].contains(&equals) {
result.push( result.push(
OsString::from_wide(&raw_env[begin..end]) OsString::from_wide(&raw_env[begin..end])
.to_string_lossy() .to_string_lossy()

View File

@@ -1,3 +1,4 @@
#![allow(clippy::result_large_err)]
use nu_protocol::{ use nu_protocol::{
CustomValue, ShellError, Span, Type, Value, CustomValue, ShellError, Span, Type, Value,
ast::{self, Math, Operator}, ast::{self, Math, Operator},

View File

@@ -1,7 +1,7 @@
use std::cmp::Ordering; #![allow(clippy::result_large_err)]
use nu_protocol::{CustomValue, ShellError, Span, Value}; use nu_protocol::{CustomValue, ShellError, Span, Value};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)] #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub struct SecondCustomValue { pub struct SecondCustomValue {

View File

@@ -1,3 +1,4 @@
#![allow(clippy::result_large_err)]
use std::{ use std::{
cmp::Ordering, cmp::Ordering,
panic::{AssertUnwindSafe, catch_unwind}, panic::{AssertUnwindSafe, catch_unwind},

View File

@@ -14,4 +14,4 @@ profile = "default"
# so that we give repo maintainers and package managers a chance to update to a more # 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 # 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. # use in nushell, we may opt to use the bleeding edge stable version of rust.
channel = "1.86.0" channel = "1.87.0"