forked from extern/nushell
Avoid taking unnecessary ownership of intermediates (#12740)
# Description Judiciously try to avoid allocations/clone by changing the signature of functions - **Don't pass str by value unnecessarily if only read** - **Don't require a vec in `Sandbox::with_files`** - **Remove unnecessary string clone** - **Fixup unnecessary borrow** - **Use `&str` in shape color instead** - **Vec -> Slice** - **Elide string clone** - **Elide `Path` clone** - **Take &str to elide clone in tests** # User-Facing Changes None # Tests + Formatting This touches many tests purely in changing from owned to borrowed/static data
This commit is contained in:
committed by
GitHub
parent
e6f473695c
commit
406df7f208
@ -119,7 +119,7 @@ fn ignores_duplicate_columns_selected() {
|
||||
#[test]
|
||||
fn selects_a_row() {
|
||||
Playground::setup("select_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("notes.txt"), EmptyFile("arepas.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("notes.txt"), EmptyFile("arepas.txt")]);
|
||||
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
@ -138,7 +138,7 @@ fn selects_a_row() {
|
||||
#[test]
|
||||
fn selects_many_rows() {
|
||||
Playground::setup("select_test_2", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![EmptyFile("notes.txt"), EmptyFile("arepas.txt")]);
|
||||
sandbox.with_files(&[EmptyFile("notes.txt"), EmptyFile("arepas.txt")]);
|
||||
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
|
Reference in New Issue
Block a user