Allow `++=` to work in all situations `++` does, namely for appending
single elements: `$list ++= 1`.
Resolve#11087
# Description
Bring `++=` to parity with `++`.
# User-Facing Changes
It is now possible to do `$list ++= 1` (appending a single element).
Similarly, this can be done:
```Nushell
~> mut a = [1]
~> $a ++= 2
~> a
╭───┬───╮
│ 0 │ 1 │
│ 1 │ 2 │
╰───┴───╯
```
# Tests + Formatting
Added two tests:
- `commands::assignment::append_assign::append_assign_single_element`
- `commands::assignment::append_assign::append_assign_to_single_element`
# Description
The working directory doesn't have to be set for those tests (or would
be the default anyways). When appropriate also remove calls to the
`pipeline()` function. In most places kept the diff minimal and only
removed the superfluous part to not pollute the blame view. With simpler
tests also simplified things to make them more readable overall (this
included removal of the raw string literal).
Work for #8670
# Description
closes#8153
This PR allows different types of lists, like `list<string>` and
`list<any>` to be appended with the `++=` operator.
## Before
```
mut args = [ hello ("hello" | path join world)]
$args ++= [ foo bar ]
Error: nu::parser::type_mismatch (link)
× Type mismatch during operation.
╭─[entry #2:1:1]
1 │ $args ++= [ foo bar ]
· ─────┬─────
· ╰── expected list<any>, found list<string>
╰────
```
## After
```
mut args = [ hello ("hello" | path join world)]
$args ++= [ foo bar ]
$args
╭───┬─────────────╮
│ 0 │ hello │
│ 1 │ hello\world │
│ 2 │ foo │
│ 3 │ bar │
╰───┴─────────────╯
```
# User-Facing Changes
_(List of all changes that impact the user experience here. This helps
us keep track of breaking changes.)_
# Tests + Formatting
Don't forget to add tests that cover your changes.
Make sure you've run and fixed any issues with these commands:
- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A
clippy::needless_collect` to check that you're using the standard code
style
- `cargo test --workspace` to check that all tests pass
# After Submitting
If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.