Rust 1.85, edition=2024 (#15741)

This commit is contained in:
Jack Wright
2025-05-13 07:49:30 -07:00
committed by GitHub
parent 1a0986903f
commit c2ac8f730e
793 changed files with 4276 additions and 3687 deletions

View File

@ -72,7 +72,7 @@ mod plugin;
#[cfg(test)]
mod test_util;
pub use plugin::{serve_plugin, EngineInterface, Plugin, PluginCommand, SimplePluginCommand};
pub use plugin::{EngineInterface, Plugin, PluginCommand, SimplePluginCommand, serve_plugin};
// Re-exports. Consider semver implications carefully.
pub use nu_plugin_core::{JsonSerializer, MsgPackSerializer, PluginEncoder};

View File

@ -1,9 +1,9 @@
//! Interface used by the plugin to communicate with the engine.
use nu_plugin_core::{
util::{Waitable, WaitableMut},
Interface, InterfaceManager, PipelineDataWriter, PluginRead, PluginWrite, StreamManager,
StreamManagerHandle,
util::{Waitable, WaitableMut},
};
use nu_plugin_protocol::{
CallInfo, CustomValueOp, EngineCall, EngineCallId, EngineCallResponse, EvaluatedCall, Ordering,
@ -11,14 +11,14 @@ use nu_plugin_protocol::{
PluginOutput, ProtocolInfo,
};
use nu_protocol::{
engine::{Closure, Sequence},
Config, DeclId, Handler, HandlerGuard, Handlers, LabeledError, PipelineData, PluginMetadata,
PluginSignature, ShellError, SignalAction, Signals, Span, Spanned, Value,
engine::{Closure, Sequence},
};
use nu_utils::SharedCow;
use std::{
collections::{btree_map, BTreeMap, HashMap},
sync::{atomic::AtomicBool, mpsc, Arc},
collections::{BTreeMap, HashMap, btree_map},
sync::{Arc, atomic::AtomicBool, mpsc},
};
/// Plugin calls that are received by the [`EngineInterfaceManager`] for handling.
@ -1044,7 +1044,7 @@ impl ForegroundGuard {
// On Unix, we need to put ourselves back in our own process group
#[cfg(unix)]
{
use nix::unistd::{setpgid, Pid};
use nix::unistd::{Pid, setpgid};
// This should always succeed, frankly, but handle the error just in case
setpgid(Pid::from_raw(0), Pid::from_raw(0)).map_err(|err| {
nu_protocol::shell_error::io::IoError::new_internal(
@ -1075,7 +1075,7 @@ impl Drop for ForegroundGuard {
#[cfg(unix)]
fn set_pgrp_from_enter_foreground(pgrp: i64) -> Result<(), ShellError> {
use nix::unistd::{setpgid, Pid};
use nix::unistd::{Pid, setpgid};
if let Ok(pgrp) = pgrp.try_into() {
setpgid(Pid::from_raw(0), Pid::from_raw(pgrp)).map_err(|err| ShellError::GenericError {
error: "Failed to set process group for foreground".into(),

View File

@ -2,22 +2,23 @@ use crate::test_util::TestCaseExt;
use super::{EngineInterfaceManager, ReceivedPluginCall};
use nu_engine::command_prelude::IoError;
use nu_plugin_core::{interface_test_util::TestCase, Interface, InterfaceManager};
use nu_plugin_core::{Interface, InterfaceManager, interface_test_util::TestCase};
use nu_plugin_protocol::{
test_util::{expected_test_custom_value, test_plugin_custom_value, TestCustomValue},
ByteStreamInfo, CallInfo, CustomValueOp, EngineCall, EngineCallId, EngineCallResponse,
EvaluatedCall, ListStreamInfo, PipelineDataHeader, PluginCall, PluginCallResponse,
PluginCustomValue, PluginInput, PluginOutput, Protocol, ProtocolInfo, StreamData,
test_util::{TestCustomValue, expected_test_custom_value, test_plugin_custom_value},
};
use nu_protocol::{
engine::Closure, BlockId, ByteStreamType, Config, CustomValue, IntoInterruptiblePipelineData,
LabeledError, PipelineData, PluginSignature, ShellError, Signals, Span, Spanned, Value, VarId,
BlockId, ByteStreamType, Config, CustomValue, IntoInterruptiblePipelineData, LabeledError,
PipelineData, PluginSignature, ShellError, Signals, Span, Spanned, Value, VarId,
engine::Closure,
};
use std::{
collections::HashMap,
sync::{
mpsc::{self, TryRecvError},
Arc,
mpsc::{self, TryRecvError},
},
};
@ -542,8 +543,8 @@ fn manager_consume_call_custom_value_op_forwards_to_receiver_with_context() -> R
}
#[test]
fn manager_consume_engine_call_response_forwards_to_subscriber_with_pipeline_data(
) -> Result<(), ShellError> {
fn manager_consume_engine_call_response_forwards_to_subscriber_with_pipeline_data()
-> Result<(), ShellError> {
let mut manager = TestCase::new().engine();
set_default_protocol_info(&mut manager)?;

View File

@ -9,15 +9,15 @@ use std::{
thread,
};
use nu_engine::documentation::{get_flags_section, HelpStyle};
use nu_engine::documentation::{HelpStyle, get_flags_section};
use nu_plugin_core::{
ClientCommunicationIo, CommunicationMode, InterfaceManager, PluginEncoder, PluginRead,
PluginWrite,
};
use nu_plugin_protocol::{CallInfo, CustomValueOp, PluginCustomValue, PluginInput, PluginOutput};
use nu_protocol::{
ast::Operator, CustomValue, IntoSpanned, LabeledError, PipelineData, PluginMetadata,
ShellError, Spanned, Value,
CustomValue, IntoSpanned, LabeledError, PipelineData, PluginMetadata, ShellError, Spanned,
Value, ast::Operator,
};
use thiserror::Error;
@ -26,7 +26,7 @@ use self::{command::render_examples, interface::ReceivedPluginCall};
mod command;
mod interface;
pub use command::{create_plugin_signature, PluginCommand, SimplePluginCommand};
pub use command::{PluginCommand, SimplePluginCommand, create_plugin_signature};
pub use interface::{EngineInterface, EngineInterfaceManager};
/// This should be larger than the largest commonly sent message to avoid excessive fragmentation.