mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 11:45:50 +02:00
Reuse existing small allocations if possible (#12335)
Those allocations are all small and insignificant in the grand scheme of things and the optimizer may be able to resolve some of those but better to be nice anyways. Primarily inspired by the new [`clippy::assigning_clones`](https://rust-lang.github.io/rust-clippy/master/index.html#/assigning_clones) - **Avoid reallocs with `clone_from` in `nu-parser`** - **Avoid realloc on assignment in `Stack`** - **Fix `clippy::assigning_clones` in `nu-cli`** - **Reuse allocations in `nu-explore` if possible**
This commit is contained in:
committed by
GitHub
parent
ce581a80a6
commit
cc39069e13
@ -663,7 +663,7 @@ fn prepare_history_metadata(
|
||||
let result = line_editor
|
||||
.update_last_command_context(&|mut c| {
|
||||
c.start_timestamp = Some(chrono::Utc::now());
|
||||
c.hostname = hostname.clone();
|
||||
c.hostname.clone_from(hostname);
|
||||
|
||||
c.cwd = Some(StateWorkingSet::new(engine_state).get_cwd());
|
||||
c
|
||||
|
Reference in New Issue
Block a user