mirror of
https://github.com/nushell/nushell.git
synced 2025-08-15 05:12:32 +02:00
Use variable names directly in the format strings (#7906)
# Description Lint: `clippy::uninlined_format_args` More readable in most situations. (May be slightly confusing for modifier format strings https://doc.rust-lang.org/std/fmt/index.html#formatting-parameters) Alternative to #7865 # User-Facing Changes None intended # Tests + Formatting (Ran `cargo +stable clippy --fix --workspace -- -A clippy::all -D clippy::uninlined_format_args` to achieve this. Depends on Rust `1.67`)
This commit is contained in:
committed by
GitHub
parent
6ae497eedc
commit
ab480856a5
@ -390,11 +390,11 @@ proptest! {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
format!(r#"
|
||||
{{"prop{0}test": "sam"}} | to nuon | from nuon;
|
||||
[ [ "prop{0}test" ]; [ 'test' ] ] | to nuon | from nuon;
|
||||
[ [ "{0}" ]; [ 'test' ] ] | to nuon | from nuon;
|
||||
{{"{0}": "sam"}} | to nuon | from nuon;
|
||||
"#, c).as_ref()
|
||||
{{"prop{c}test": "sam"}} | to nuon | from nuon;
|
||||
[ [ "prop{c}test" ]; [ 'test' ] ] | to nuon | from nuon;
|
||||
[ [ "{c}" ]; [ 'test' ] ] | to nuon | from nuon;
|
||||
{{"{c}": "sam"}} | to nuon | from nuon;
|
||||
"#).as_ref()
|
||||
));
|
||||
assert!(actual.err.is_empty() || actual.err.contains("Unexpected end of code") || actual.err.contains("only strings can be keys") || actual.err.contains("unbalanced { and }"));
|
||||
// The second is for weird escapes due to backslashes
|
||||
@ -407,11 +407,11 @@ proptest! {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
format!(r#"
|
||||
{{"prop{0}test": "sam"}} | to nuon | from nuon;
|
||||
[ [ "prop{0}test" ]; [ 'test' ] ] | to nuon | from nuon;
|
||||
[ [ "{0}" ]; [ 'test' ] ] | to nuon | from nuon;
|
||||
{{"{0}": "sam"}} | to nuon | from nuon;
|
||||
"#, s).as_ref()
|
||||
{{"prop{s}test": "sam"}} | to nuon | from nuon;
|
||||
[ [ "prop{s}test" ]; [ 'test' ] ] | to nuon | from nuon;
|
||||
[ [ "{s}" ]; [ 'test' ] ] | to nuon | from nuon;
|
||||
{{"{s}": "sam"}} | to nuon | from nuon;
|
||||
"#).as_ref()
|
||||
));
|
||||
assert!(actual.err.is_empty() || actual.err.contains("only strings can be keys") || actual.err.contains("unknown command"));
|
||||
// TODO: fix parser error for "unknown command" when '=$' is the name
|
||||
|
Reference in New Issue
Block a user