mirror of
https://github.com/nushell/nushell
synced 2024-12-25 20:43:09 +00:00
Fix clippy lints (#4262)
* Fix clippy lints * Fix clippy lints * Fix clippy lints
This commit is contained in:
parent
e6c09f2dfc
commit
f562a4526c
11 changed files with 16 additions and 17 deletions
|
@ -231,7 +231,6 @@
|
|||
|
||||
#![crate_name = "nu_ansi_term"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![warn(missing_copy_implementations)]
|
||||
// #![warn(missing_docs)]
|
||||
#![warn(trivial_casts, trivial_numeric_casts)]
|
||||
|
|
|
@ -91,10 +91,10 @@ pub fn run_script_file(
|
|||
fn default_prompt_string(cwd: &str) -> String {
|
||||
format!(
|
||||
"{}{}{}{}{}{}> ",
|
||||
Color::Green.bold().prefix().to_string(),
|
||||
Color::Green.bold().prefix(),
|
||||
cwd,
|
||||
nu_ansi_term::ansi::RESET,
|
||||
Color::Cyan.bold().prefix().to_string(),
|
||||
Color::Cyan.bold().prefix(),
|
||||
current_branch(),
|
||||
nu_ansi_term::ansi::RESET
|
||||
)
|
||||
|
|
|
@ -93,7 +93,7 @@ pub fn source(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
|||
|
||||
let path = canonicalize(source_file).map_err(|e| {
|
||||
ShellError::labeled_error(
|
||||
format!("Can't load source file. Reason: {}", e.to_string()),
|
||||
format!("Can't load source file. Reason: {}", e),
|
||||
"Can't load this file",
|
||||
filename.span(),
|
||||
)
|
||||
|
@ -112,7 +112,7 @@ pub fn source(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
|||
}
|
||||
Err(e) => {
|
||||
ctx.error(ShellError::labeled_error(
|
||||
format!("Can't load source file. Reason: {}", e.to_string()),
|
||||
format!("Can't load source file. Reason: {}", e),
|
||||
"Can't load this file",
|
||||
filename.span(),
|
||||
));
|
||||
|
|
|
@ -197,7 +197,7 @@ fn process_row(
|
|||
} else {
|
||||
let mut obj = input.clone();
|
||||
|
||||
for column in column_paths.clone() {
|
||||
for column in column_paths {
|
||||
let path = UntaggedValue::Primitive(Primitive::ColumnPath(column.clone()))
|
||||
.into_value(tag);
|
||||
let data = r.get_data(&as_string(&path)?).borrow().clone();
|
||||
|
|
|
@ -104,7 +104,7 @@ fn kill(args: CommandArgs) -> Result<ActionStream, ShellError> {
|
|||
}
|
||||
cmd.arg("-9");
|
||||
} else if let Some(signal_value) = signal {
|
||||
cmd.arg(format!("-{}", signal_value.item().to_string()));
|
||||
cmd.arg(format!("-{}", signal_value.item()));
|
||||
}
|
||||
|
||||
cmd.arg(pid.item().to_string());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::prelude::*;
|
||||
use nu_errors::ShellError;
|
||||
use nu_protocol::{Signature, TaggedDictBuilder, UntaggedValue};
|
||||
use sysinfo::{ProcessExt, System, SystemExt};
|
||||
use sysinfo::{PidExt, ProcessExt, System, SystemExt};
|
||||
|
||||
pub struct Command;
|
||||
|
||||
|
@ -50,7 +50,7 @@ fn run_ps(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
|||
for pid in result {
|
||||
if let Some(result) = sys.process(pid) {
|
||||
let mut dict = TaggedDictBuilder::new(args.name_tag());
|
||||
dict.insert_untagged("pid", UntaggedValue::int(pid as i64));
|
||||
dict.insert_untagged("pid", UntaggedValue::int(pid.as_u32() as i64));
|
||||
dict.insert_untagged("name", UntaggedValue::string(result.name()));
|
||||
dict.insert_untagged(
|
||||
"status",
|
||||
|
@ -68,7 +68,7 @@ fn run_ps(args: CommandArgs) -> Result<OutputStream, ShellError> {
|
|||
|
||||
if long {
|
||||
if let Some(parent) = result.parent() {
|
||||
dict.insert_untagged("parent", UntaggedValue::int(parent as i64));
|
||||
dict.insert_untagged("parent", UntaggedValue::int(parent.as_u32() as i64));
|
||||
} else {
|
||||
dict.insert_untagged("parent", UntaggedValue::nothing());
|
||||
}
|
||||
|
|
|
@ -970,7 +970,7 @@ fn move_item(from: &Path, from_tag: &Tag, to: &Path) -> Result<(), ShellError> {
|
|||
} {
|
||||
Ok(_) => Ok(()),
|
||||
Err(e) => Err(ShellError::labeled_error(
|
||||
format!("Could not move {:?} to {:?}. {:}", from, to, e.to_string()),
|
||||
format!("Could not move {:?} to {:?}. {:}", from, to, e),
|
||||
"could not move",
|
||||
from_tag,
|
||||
)),
|
||||
|
|
|
@ -147,7 +147,7 @@ pub fn process_script(
|
|||
{
|
||||
val.to_string()
|
||||
} else {
|
||||
format!("{}\\", name.to_string())
|
||||
format!("{}\\", name)
|
||||
}
|
||||
} else {
|
||||
name.to_string()
|
||||
|
|
|
@ -75,7 +75,7 @@ fn find_source_file(
|
|||
|
||||
let path = canonicalize(&file).map_err(|e| {
|
||||
ParseError::general_error(
|
||||
format!("Can't load source file. Reason: {}", e.to_string()),
|
||||
format!("Can't load source file. Reason: {}", e),
|
||||
"Can't load this file".spanned(file_span),
|
||||
)
|
||||
})?;
|
||||
|
@ -85,7 +85,7 @@ fn find_source_file(
|
|||
match contents {
|
||||
Ok(contents) => parse(&contents, 0, scope),
|
||||
Err(e) => Err(ParseError::general_error(
|
||||
format!("Can't load source file. Reason: {}", e.to_string()),
|
||||
format!("Can't load source file. Reason: {}", e),
|
||||
"Can't load this file".spanned(file_span),
|
||||
)),
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ impl Executable for Director {
|
|||
.spawn()
|
||||
{
|
||||
Ok(child) => child,
|
||||
Err(why) => panic!("Can't run test {}", why.to_string()),
|
||||
Err(why) => panic!("Can't run test {}", why),
|
||||
};
|
||||
|
||||
if let Some(pipelines) = &self.pipeline {
|
||||
|
|
|
@ -12,9 +12,9 @@ pub mod support {
|
|||
pub fn in_path(dirs: &Dirs, block: impl FnOnce() -> Outcome) -> Outcome {
|
||||
let for_env_manifest = dirs.test().to_string_lossy();
|
||||
|
||||
nu!(cwd: dirs.root(), format!("autoenv trust \"{}\"", for_env_manifest.to_string()));
|
||||
nu!(cwd: dirs.root(), format!("autoenv trust \"{}\"", for_env_manifest));
|
||||
let out = block();
|
||||
nu!(cwd: dirs.root(), format!("autoenv untrust \"{}\"", for_env_manifest.to_string()));
|
||||
nu!(cwd: dirs.root(), format!("autoenv untrust \"{}\"", for_env_manifest));
|
||||
|
||||
out
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue