mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 06:58:36 +02:00
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
@ -136,7 +136,7 @@ fn plugin_add_to_custom_path() {
|
||||
fn plugin_rm_then_restart_nu() {
|
||||
let example_plugin_path = example_plugin_path();
|
||||
Playground::setup("plugin rm from custom path", |dirs, playground| {
|
||||
playground.with_files(vec![
|
||||
playground.with_files(&[
|
||||
Stub::FileWithContent("config.nu", ""),
|
||||
Stub::FileWithContent("env.nu", ""),
|
||||
]);
|
||||
@ -318,7 +318,7 @@ fn plugin_rm_using_filename() {
|
||||
fn warning_on_invalid_plugin_item() {
|
||||
let example_plugin_path = example_plugin_path();
|
||||
Playground::setup("warning on invalid plugin item", |dirs, playground| {
|
||||
playground.with_files(vec![
|
||||
playground.with_files(&[
|
||||
Stub::FileWithContent("config.nu", ""),
|
||||
Stub::FileWithContent("env.nu", ""),
|
||||
]);
|
||||
@ -380,7 +380,7 @@ fn warning_on_invalid_plugin_item() {
|
||||
#[test]
|
||||
fn plugin_use_error_not_found() {
|
||||
Playground::setup("plugin use error not found", |dirs, playground| {
|
||||
playground.with_files(vec![
|
||||
playground.with_files(&[
|
||||
Stub::FileWithContent("config.nu", ""),
|
||||
Stub::FileWithContent("env.nu", ""),
|
||||
]);
|
||||
|
Reference in New Issue
Block a user