Jaffar Ashoor
c3c41a61b0
replace lazy_static with once_cell ( #7502 )
...
replacing the dependence on `lazy_static` with `once_cell`, this will
ensure that variables are initialized when needed instead of startup
time.
2022-12-17 10:30:04 -08:00
Nano
da7f77867a
Fixed json parsing ( #7175 )
...
# Description
I noticed that some json values are not parsed at the top level, for
example: `null`, `true`, `false`. Although this is a valid json.
```
> "null" | from json
Error:
× Error while parsing JSON text
╭─[entry #12:1:1]
1 │ "null" | from json
· ────┬────
· ╰── error parsing JSON text
╰────
Error:
× Error while parsing JSON text
╭────
1 │ null
╰────
```
I tried to fix it and it seems to work fine.
# User-Facing Changes
It should give fewer errors.
# 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 --features=extra -- -D warnings -D
clippy::unwrap_used -A clippy::needless_collect` to check that you're
using the standard code style
- `cargo test --workspace --features=extra` 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.
Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
2022-11-23 17:00:00 +13:00
Alex Saveau
be5d71ea47
Run a round of clippy --fix to fix a ton of lints ( #7006 )
...
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-11-04 15:11:17 -05:00
Darren Schroeder
cdeb8de75d
replace the regex crate with the fancy-regex crate ( #6227 )
2022-08-04 14:51:02 -05:00
pwygab
8a0bd20e84
Prevents panic when parsing JSON containing large number ( #6096 )
...
* prevents panic when parsing JSON containing large number
* fmt
* check for '-' sign first
* fmt
* clippy
2022-07-23 13:31:06 +12:00
Stefan Holderbach
e5d38dcff6
Address lints from clippy for beta/nightly ( #5709 )
...
* Fix clippy lints in tests
* Replace `format!` in `.push_str()` with `write!`
Stylistically that might be a bit rough but elides an allocation.
Fallibility of allocation is more explicit, but ignored with `let _ =`
like in the clippy example:
https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string
* Remove unused lifetime
* Fix macro crate relative import
* Derive `Eq` for `PartialEq` with `Eq` members
https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq
* Remove unnnecessary `.to_string()` for Cow<str>
* Remove `.to_string()` for `tendril::Tendril`
Implements `Deref<Target = str>`
2022-06-04 18:47:36 +12:00
Herlon Aguiar
5e177fe8e7
nu-cli/completions: fix file completions filtering ( #5122 )
2022-04-08 07:31:56 +12:00
Daniel Reilly
52f4c4ba7e
Adds tab indentation option for JSON files. ( #4705 )
2022-03-03 13:15:13 -05:00
JT
3c62d27c28
Try again with math-like externals ( #4629 )
...
* Try again with math-like externals
* clippy 1.59
* clippy 1.59
* clippy 1.59
2022-02-24 14:02:28 -05:00
Joseph T. Lyons
5bf2ffeaf5
Add indent flag to to json
(first draft) ( #4571 )
...
* Add indent flag to `to json` (first draft)
* Run cargo fmt
* Update examples / tests
* Change order of examples
2022-02-20 16:29:19 -06:00
JT
84f85ff9ae
Fix to json
escape logic ( #4478 )
2022-02-15 06:55:57 -05:00
JT
d70d91e559
Remove old nushell/merge engine-q
2022-02-07 14:54:06 -05:00
Fernando Herrera
fdce6c49ab
engine-q merge
2022-02-07 19:11:34 +00:00
Michael Angerman
f50f37c853
fix issue #559 : to json -r serializes datetime without spaces ( #596 )
...
* fix issue #559 : to json -r serializes datetime without spaces
* add in a third test which checks spaces in both keys and values
* fix clippy error
2021-12-27 21:51:38 +11:00
Michael Angerman
5d3b63fa90
add in a raw flag in the command to json ( #555 )
...
* add in the method to_string_raw
* add in a raw flag to json
* add in a test
2021-12-23 06:56:49 +11:00
Andrew Houts
ee9eddd851
avoid unnecessary allocation ( #4178 )
2021-12-06 07:38:58 +13:00
JT
624edce4f7
Add 'to json'
2021-10-29 19:26:29 +13:00
JT
3e232a5db8
Add 'from json'
2021-10-01 18:11:49 +13:00
Marcin Puc
51c74eebd0
Add general refactorings ( #3996 )
2021-09-10 10:44:22 +12:00
JT
91a929b2a9
Clippy fixes for new Rust version ( #3392 )
2021-05-07 07:58:21 +12:00
Waldir Pimenta
4bc9d9fd3b
Fix typos and capitalization of "Unicode" ( #3234 )
...
* Capitalize "Unicode"
* Fix several typos
* Fix mixed whitespace in nu-parser's tests
2021-04-04 07:14:07 +12:00
Jonathan Turner
7e184b58b2
Fix warnings for Rust 1.51 ( #3214 )
...
* Fix warnings for Rust 1.51
* More fixes
* More fixes
2021-03-26 21:26:57 +13:00
Andrés N. Robalino
0b71e45072
Preserve order when serializing/deserialize json by default. ( #3126 )
2021-03-04 01:35:13 -05:00
Jonathan Turner
5481db4079
Fix latest clippy warnings ( #3049 )
2021-02-12 23:13:14 +13:00
Joseph T. Lyons
15d49e4096
Rust 1.49 Clippy Fixes ( #2835 )
2021-01-01 15:13:59 +13:00
Jonathan Turner
930f9f0063
Fix new clippy warnings ( #2760 )
...
* Fix new clippy warnings
* Fork serde-hjson and bring in
* Fork serde-hjson and bring in
* Fix clippy lint again
2020-11-22 13:37:16 +13:00