1776 Commits

Author SHA1 Message Date
David Tolnay
13591f1dd4
Convert html links to intra-doc links 2025-02-19 17:51:29 -08:00
David Tolnay
1d7378e8ee
Unset doc-scrape-examples for lib target
False is the default value since Cargo PR 11499.
2025-02-09 17:52:36 -08:00
David Tolnay
1174c5f57d
Resolve unnecessary_semicolon pedantic clippy lint
warning: unnecessary semicolon
       --> src/de.rs:371:10
        |
    371 |         };
        |          ^ help: remove
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_semicolon
        = note: `-W clippy::unnecessary-semicolon` implied by `-W clippy::pedantic`
        = help: to override `-W clippy::pedantic` add `#[allow(clippy::unnecessary_semicolon)]`
2025-01-29 18:20:18 -08:00
David Tolnay
c916099147
Release 1.0.138 v1.0.138 2025-01-28 09:31:20 -08:00
David Tolnay
dc29e4815d
Move BufReader to caller
The original read_user_from_stream function from PR 1237 is a bad
pattern because it results in silently dropping any data left in the
buffer on return. If we want to read anything else from the same
TcpStream after the JSON object, the buffer needs to go in the caller.
2025-01-28 09:22:50 -08:00
David Tolnay
29122f9ed7
Sort imports from PR 1237 2025-01-28 09:18:47 -08:00
David Tolnay
d33c1b527e
Merge pull request #1237 from JonathanBrouwer/master
Improve documentation for buffering around functions taking a reader
2025-01-28 09:18:00 -08:00
Jonathan Brouwer
8c2d8004b2
Add more warnings to apply buffering on docs of affected functions 2025-01-28 08:47:21 +01:00
Jonathan Brouwer
65bbd1aa2d
Fix example of from_reader not applying buffering when it should 2025-01-28 08:38:17 +01:00
David Tolnay
87f78da0f5
More precise gitignore patterns 2025-01-23 01:40:57 -08:00
David Tolnay
4134f119c0
Remove *.sw[po] from gitignore
This belongs in someone's global gitignore.
2025-01-22 19:37:18 -08:00
David Tolnay
c7626dbac2
Remove **/*.rs.bk from project-specific gitignore
Cargo stopped generating this in its project template 5 years ago. It
would belong in a global gitignore instead.
2025-01-22 19:30:32 -08:00
David Tolnay
eb49e28204
Release 1.0.137 v1.0.137 2025-01-19 15:11:21 -08:00
David Tolnay
51c48ab3b0
Merge pull request #1231 from dtolnay/playground
Enable "float_roundtrip" and "unbounded_depth" features in playground
2025-01-19 15:10:47 -08:00
David Tolnay
7d8f15b963
Enable "float_roundtrip" and "unbounded_depth" features in playground 2025-01-19 15:04:54 -08:00
David Tolnay
a46f14cf2e
Release 1.0.136 v1.0.136 2025-01-18 16:50:05 -08:00
David Tolnay
eb9f3f6387
Merge pull request #1230 from goffrie/patch-1
Use Map::with_capacity in value::Serializer::serialize_map
2025-01-18 16:49:16 -08:00
Geoffry Song
513e5b2f74
Use Map::with_capacity in value::Serializer::serialize_map 2025-01-18 15:38:08 -08:00
David Tolnay
9802c08d4e
Release 1.0.135 v1.0.135 2025-01-06 16:21:47 -08:00
David Tolnay
b97935fde2
Merge pull request #1226 from tisonkun/map-into-values
Add Map::into_values method
2025-01-06 16:21:14 -08:00
tison
d48c224d12
Add Map::into_values method
Signed-off-by: tison <wander4096@gmail.com>
2025-01-07 08:10:53 +08:00
David Tolnay
1e77cac742
Resolve precedence clippy lint
warning: operator precedence can trip the unwary
       --> src/read.rs:963:18
        |
    963 |         let n = (((n1 - 0xD800) as u32) << 10 | (n2 - 0xDC00) as u32) + 0x1_0000;
        |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(((n1 - 0xD800) as u32) << 10) | (n2 - 0xDC00) as u32`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence
        = note: `-W clippy::precedence` implied by `-W clippy::all`
        = help: to override `-W clippy::all` add `#[allow(clippy::precedence)]`

    warning: operator precedence can trip the unwary
       --> src/read.rs:991:28
        |
    991 |                 ptr.write((n >> 6 & 0b0001_1111) as u8 | 0b1100_0000);
        |                            ^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(n >> 6) & 0b0001_1111`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence

    warning: operator precedence can trip the unwary
       --> src/read.rs:995:28
        |
    995 |                 ptr.write((n >> 12 & 0b0000_1111) as u8 | 0b1110_0000);
        |                            ^^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(n >> 12) & 0b0000_1111`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence

    warning: operator precedence can trip the unwary
       --> src/read.rs:996:35
        |
    996 |                 ptr.add(1).write((n >> 6 & 0b0011_1111) as u8 | 0b1000_0000);
        |                                   ^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(n >> 6) & 0b0011_1111`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence

    warning: operator precedence can trip the unwary
        --> src/read.rs:1000:28
         |
    1000 |                 ptr.write((n >> 18 & 0b0000_0111) as u8 | 0b1111_0000);
         |                            ^^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(n >> 18) & 0b0000_0111`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence

    warning: operator precedence can trip the unwary
        --> src/read.rs:1002:29
         |
    1002 |                     .write((n >> 12 & 0b0011_1111) as u8 | 0b1000_0000);
         |                             ^^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(n >> 12) & 0b0011_1111`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence

    warning: operator precedence can trip the unwary
        --> src/read.rs:1003:35
         |
    1003 |                 ptr.add(2).write((n >> 6 & 0b0011_1111) as u8 | 0b1000_0000);
         |                                   ^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(n >> 6) & 0b0011_1111`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence
2024-12-26 18:30:54 -08:00
David Tolnay
b2a1415aad
Release 1.0.134 v1.0.134 2024-12-21 10:54:55 -08:00
David Tolnay
9875785f24
Tweak wording of NULL/TRUE/FALSE documentation 2024-12-21 10:51:05 -08:00
David Tolnay
4aa05b9143
Merge pull request #1222 from dtolnay/rawvalueassoc
Move RawValue associated constants into same impl block as public functions
2024-12-11 11:06:54 -08:00
David Tolnay
f42c7c760b
Move RawValue associated constants into same impl block as public functions 2024-12-11 10:58:22 -08:00
David Tolnay
96576bad53
Merge pull request #1221 from bheylin/add-const-raw-values-for-null-and-bools
Add literal 'null', 'true' and 'false' consts to `RawValue` struct.
2024-12-11 10:56:35 -08:00
Brian Heylin
4db66fb0b2 Add 'static lifetime to const's 2024-12-11 10:14:15 +01:00
Brian Heylin
9c9aa1f380 Add literal 'null', 'true' and 'false' consts to RawValue struct. 2024-12-11 09:10:27 +01:00
David Tolnay
0903de449c
Release 1.0.133 v1.0.133 2024-11-16 17:26:01 -08:00
David Tolnay
2b65ca0949
Merge pull request #1215 from dtolnay/fromarray
Implement From<[T; N]> for Value
2024-11-16 17:25:28 -08:00
David Tolnay
4e5f985958
Implement From<[T; N]> for Value 2024-11-16 17:17:56 -08:00
David Tolnay
2ccb5b67ca
Disable question_mark clippy lint in lexical test
Serde_json uses #![deny(clippy::question_mark_used)].

    warning: this `match` expression can be replaced with `?`
      --> tests/../src/lexical/algorithm.rs:54:21
       |
    54 |           let value = match mantissa.checked_mul(power) {
       |  _____________________^
    55 | |             None => return None,
    56 | |             Some(value) => value,
    57 | |         };
       | |_________^ help: try instead: `mantissa.checked_mul(power)?`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
       = note: `-W clippy::question-mark` implied by `-W clippy::all`
       = help: to override `-W clippy::all` add `#[allow(clippy::question_mark)]`
2024-11-15 18:50:53 -08:00
David Tolnay
a11f5f2bc4
Resolve unnecessary_map_or clippy lints
warning: this `map_or` is redundant
     --> src/value/partial_eq.rs:5:5
      |
    5 |     value.as_i64().map_or(false, |i| i == other)
      |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a standard comparison instead: `(value.as_i64() == Some(other))`
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
      = note: `-W clippy::unnecessary-map-or` implied by `-W clippy::all`
      = help: to override `-W clippy::all` add `#[allow(clippy::unnecessary_map_or)]`

    warning: this `map_or` is redundant
     --> src/value/partial_eq.rs:9:5
      |
    9 |     value.as_u64().map_or(false, |i| i == other)
      |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a standard comparison instead: `(value.as_u64() == Some(other))`
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or

    warning: this `map_or` is redundant
      --> src/value/partial_eq.rs:14:29
       |
    14 |         Value::Number(n) => n.as_f32().map_or(false, |i| i == other),
       |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a standard comparison instead: `(n.as_f32() == Some(other))`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or

    warning: this `map_or` is redundant
      --> src/value/partial_eq.rs:20:5
       |
    20 |     value.as_f64().map_or(false, |i| i == other)
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a standard comparison instead: `(value.as_f64() == Some(other))`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or

    warning: this `map_or` is redundant
      --> src/value/partial_eq.rs:24:5
       |
    24 |     value.as_bool().map_or(false, |i| i == other)
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a standard comparison instead: `(value.as_bool() == Some(other))`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or

    warning: this `map_or` is redundant
      --> src/value/partial_eq.rs:28:5
       |
    28 |     value.as_str().map_or(false, |i| i == other)
       |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a standard comparison instead: `(value.as_str() == Some(other))`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
2024-11-15 18:47:58 -08:00
David Tolnay
07f280a79c
Wrap PR 1213 to 80 columns 2024-11-14 18:44:18 -08:00
David Tolnay
75ed44722d
Merge pull request #1213 from djmitche/safety-comment
Add a safety comment to unsafe block
2024-11-14 18:43:52 -08:00
Dustin J. Mitchell
73011c0b2b Add a safety comment to unsafe block 2024-11-14 22:16:25 +00:00
David Tolnay
be2198a54d
Prevent upload-artifact step from causing CI failure
This step has been failing way more than reasonable across my various repos.

    With the provided path, there will be 1 file uploaded
    Artifact name is valid!
    Root directory input is valid!
    Attempt 1 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact. Retrying request in 3000 ms...
    Attempt 2 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact. Retrying request in 6029 ms...
    Attempt 3 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact. Retrying request in 8270 ms...
    Attempt 4 of 5 failed with error: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact. Retrying request in 12577 ms...
    Error: Failed to CreateArtifact: Failed to make request after 5 attempts: Request timeout: /twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact
2024-11-08 21:45:52 -05:00
David Tolnay
7cce517f53
Raise minimum version for preserve_order feature to Rust 1.65
Required by hashbrown 0.15.1.

    error: package `hashbrown v0.15.1` cannot be built because it requires rustc 1.65.0 or newer, while the currently active rustc version is 1.64.0
2024-11-04 18:20:00 -08:00
David Tolnay
42ab31feac
Update ui test suite to nightly-2024-10-31 2024-10-30 19:18:57 -07:00
David Tolnay
86d933cfd7
Release 1.0.132 v1.0.132 2024-10-19 09:32:49 -07:00
David Tolnay
f45b422a3b
Merge pull request #1206 from dtolnay/hasnext
Improve performance of seq/map peeks
2024-10-19 09:32:23 -07:00
David Tolnay
f2082d2a04
Clearer order of comparisons
We look at seq.first/map.first only once.
2024-10-19 09:23:00 -07:00
David Tolnay
0f54a1a0df
Handle early return sooner on eof in seq or map
This matches how peeking is done within deserialize_any and other
Deserializer methods
2024-10-19 09:22:34 -07:00
David Tolnay
2a4cb44f7c
Rearrange 'match peek' 2024-10-19 09:21:55 -07:00
David Tolnay
4cb90ce66d
Merge pull request #1205 from dtolnay/hasnext
Reduce duplicative instantiation of logic in SeqAccess and MapAccess
2024-10-19 09:20:49 -07:00
David Tolnay
b71ccd2d8f
Reduce duplicative instantiation of logic in SeqAccess and MapAccess 2024-10-19 08:50:31 -07:00
David Tolnay
a810ba9850
Release 1.0.131 v1.0.131 2024-10-18 15:50:51 -07:00
David Tolnay
0d084c5038
Touch up PR 1135 2024-10-18 15:49:44 -07:00
David Tolnay
b4954a9561
Merge pull request #1135 from swlynch99/map-deserializer
Implement `Deserializer` for `Map<String, Value>` and `&Map<String, Value>`
2024-10-18 15:49:00 -07:00