1316 Commits

Author SHA1 Message Date
David Tolnay
a0ea9371cd
Release 1.0.81 v1.0.81 2022-05-03 12:19:34 -07:00
David Tolnay
6c3dfe948a
Make it clearer that preserve_order implies a std dependency
As indicated in the summary of #885.
2022-05-03 12:18:34 -07:00
David Tolnay
f34ef95fd1
Merge pull request #885 from cuviper/indexmap-std
Explicitly enable indexmap/std
2022-05-03 12:17:44 -07:00
Josh Stone
27939bb1f9 Explicitly enable indexmap/std 2022-05-03 11:57:05 -07:00
David Tolnay
c0f93432cc
Ignore trait_duplication_in_bounds clippy false positives
https://github.com/rust-lang/rust-clippy/issues/8757

    error: this trait bound is already specified in the where clause
      --> tests/regression/issue845.rs:13:8
       |
    13 |     T: TryFrom<u64> + TryFrom<i64> + FromStr,
       |        ^^^^^^^^^^^^
       |
       = note: `-D clippy::trait-duplication-in-bounds` implied by `-D clippy::pedantic`
       = help: consider removing this trait bound
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trait_duplication_in_bounds

    error: this trait bound is already specified in the where clause
      --> tests/regression/issue845.rs:14:33
       |
    14 |     <T as TryFrom<u64>>::Error: Display,
       |                                 ^^^^^^^
       |
       = help: consider removing this trait bound
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trait_duplication_in_bounds

    error: this trait bound is already specified in the where clause
      --> tests/regression/issue845.rs:49:8
       |
    49 |     T: TryFrom<u64> + TryFrom<i64> + FromStr,
       |        ^^^^^^^^^^^^
       |
       = help: consider removing this trait bound
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trait_duplication_in_bounds

    error: this trait bound is already specified in the where clause
      --> tests/regression/issue845.rs:50:33
       |
    50 |     <T as TryFrom<u64>>::Error: Display,
       |                                 ^^^^^^^
       |
       = help: consider removing this trait bound
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#trait_duplication_in_bounds
2022-04-30 20:19:52 -07:00
David Tolnay
048a64caec
Resolve type_repetition_in_bounds clippy lint
error: this type has already been used as a bound predicate
       --> src/value/ser.rs:278:9
        |
    278 |         T: Display,
        |         ^^^^^^^^^^
        |
        = note: `-D clippy::type-repetition-in-bounds` implied by `-D clippy::pedantic`
        = help: consider combining the bounds: `T: Sized + Display`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> src/value/ser.rs:611:9
        |
    611 |         T: Display,
        |         ^^^^^^^^^^
        |
        = help: consider combining the bounds: `T: Sized + Display`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds
2022-04-30 20:16:37 -07:00
David Tolnay
585e4c5dc7
Release 1.0.80 v1.0.80 2022-04-30 12:16:22 -07:00
David Tolnay
52a9c050f5
Pull miri from miri branch of dtolnay/rust-toolchain 2022-04-28 19:38:27 -07:00
David Tolnay
aff685b8c9
Drop unneeded quoting from env variable in workflows yaml 2022-04-28 19:37:41 -07:00
David Tolnay
6995bbf784
Update workflows to actions/checkout@v3 2022-04-24 19:06:54 -07:00
David Tolnay
829175e606
Fix dev dependencies on serde's derive feature 2022-03-30 11:33:22 -07:00
David Tolnay
2733e635b3
Rewrap readme to 80 columns 2022-02-28 14:37:37 -08:00
David Tolnay
c5475a32db
Apply readme changes from PR 864 to crate-level rustdoc 2022-02-28 14:36:06 -08:00
David Tolnay
56cf16f900
Merge pull request 864 from novedevo/patch-1 2022-02-28 14:33:21 -08:00
Devon Sawatsky
16b68b06d6
Tweak grammar to improve readability 2022-02-28 14:19:14 -08:00
David Tolnay
7025523603
Release 1.0.79 v1.0.79 2022-02-11 20:51:15 -08:00
David Tolnay
7e56a406e5
Merge pull request #830 from lucacasonato/support_lone_surrogates_in_raw_value
Allow lone surrogates in raw values
2022-02-11 20:43:06 -08:00
David Tolnay
977975ee65
Ignore buggy ptr_arg clippy lint
https://github.com/rust-lang/rust-clippy/issues/8366

    error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
      --> src/read.rs:65:45
       |
    65 |     fn parse_str<'s>(&'s mut self, scratch: &'s mut Vec<u8>) -> Result<Reference<'de, 's, str>>;
       |                                             ^^^^^^^^^^^^^^^ help: change this to: `&'s mut [u8]`
       |
       = note: `-D clippy::ptr-arg` implied by `-D clippy::all`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg

    error: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do
      --> src/read.rs:76:18
       |
    76 |         scratch: &'s mut Vec<u8>,
       |                  ^^^^^^^^^^^^^^^ help: change this to: `&'s mut [u8]`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
2022-01-28 19:00:25 -08:00
David Tolnay
aa78d6ca4e
Resolve needless_borrow clippy lint
error: this expression borrows a value the compiler would automatically borrow
       --> tests/../src/lexical/math.rs:597:25
        |
    597 |         for (xi, yi) in (&mut x[xstart..]).iter_mut().zip(y.iter()) {
        |                         ^^^^^^^^^^^^^^^^^^ help: change this to: `x[xstart..]`
        |
        = note: `-D clippy::needless-borrow` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
2022-01-28 19:00:25 -08:00
David Tolnay
98cafacefe
Release 1.0.78 v1.0.78 2022-01-22 15:57:11 -08:00
David Tolnay
2d81cbd113
Move raw_value test imports to block of imports 2022-01-22 15:30:46 -08:00
David Tolnay
cbb0342ba0
Merge pull request #851 from serde-rs/rawkey
Support deserializing map key as &RawValue
2022-01-22 15:30:38 -08:00
David Tolnay
e5cdfcc7ee
Support deserializing map key as &RawValue 2022-01-22 15:19:44 -08:00
David Tolnay
6a3fb68979
Add test of deserializing a &RawValue in map key position
Currently fails with:

    ---- test_raw_value_in_map_key stdout ----
    thread 'test_borrowed_raw_value' panicked at 'called `Result::unwrap()`
    on an `Err` value: Error("invalid type: newtype struct, expected any
    valid JSON value", line: 1, column: 2)', tests/test.rs:2230:52
2022-01-22 15:19:28 -08:00
David Tolnay
d8512af496
Release 1.0.77 v1.0.77 2022-01-22 12:52:01 -08:00
David Tolnay
5fe9bdd356
Improve error on compiling with neither std nor alloc
Before:

    error: expected item, found `"serde_json requires that either `std` (default) or `alloc` feature is enabled"`
     --> src/features_check/error.rs:1:1
      |
    1 | "serde_json requires that either `std` (default) or `alloc` feature is enabled"
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected item

    error[E0407]: method `visit_string` is not a member of trait `Visitor`
       --> src/raw.rs:455:5
        |
    455 |       fn visit_string<E>(self, s: String) -> Result<Self::Value, E>
        |       ^  ------------ help: there is an associated function with a similar name: `visit_str`
        |  _____|
        | |
    456 | |     where
    457 | |         E: de::Error,
    458 | |     {
    459 | |         Ok(RawValue::from_owned(s.into_boxed_str()))
    460 | |     }
        | |_____^ not a member of trait `Visitor`

    error[E0046]: not all trait items implemented, missing: `collect_str`
        --> src/ser.rs:1376:1
         |
    1376 | impl<'a, W: io::Write, F: Formatter> ser::Serializer for RawValueStrEmitter<'a, W, F> {
         | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `collect_str` in implementation
         |
         = help: implement the missing item: `fn collect_str<T>(self, _: &T) -> core::result::Result<<Self as serde::Serializer>::Ok, <Self as serde::Serializer>::Error> where T: Display { todo!() }`

    error[E0046]: not all trait items implemented, missing: `collect_str`
       --> src/value/ser.rs:864:1
        |
    864 | impl serde::ser::Serializer for RawValueEmitter {
        | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `collect_str` in implementation
        |
        = help: implement the missing item: `fn collect_str<T>(self, _: &T) -> core::result::Result<<Self as serde::Serializer>::Ok, <Self as serde::Serializer>::Error> where T: Display { todo!() }`

    error[E0599]: no method named `visit_string` found for struct `BoxedFromString` in the current scope
       --> src/raw.rs:452:14
        |
    428 | pub struct BoxedFromString;
        | --------------------------- method `visit_string` not found for this
    ...
    452 |         self.visit_string(s.to_owned())
        |              ^^^^^^^^^^^^ method not found in `BoxedFromString`

After:

    error: expected item, found `"serde_json requires that either `std` (default) or `alloc` feature is enabled"`
     --> src/features_check/error.rs:1:1
      |
    1 | "serde_json requires that either `std` (default) or `alloc` feature is enabled"
      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected item
2022-01-22 12:45:09 -08:00
David Tolnay
4c15649318
Include integration tests in published package
Closes #578.
2022-01-22 12:07:29 -08:00
David Tolnay
71257c5667
Add discord invite links 2022-01-22 11:47:14 -08:00
David Tolnay
19e9b749ce
Release 1.0.76 v1.0.76 2022-01-22 05:07:46 -08:00
David Tolnay
8ecd48308a
Fix imports on features +alloc +raw_value -std
Closes #850.
2022-01-22 05:07:00 -08:00
David Tolnay
a22b686f49
Release 1.0.75 v1.0.75 2022-01-15 16:53:20 -08:00
David Tolnay
36c43bfed5
Merge pull request #848 from serde-rs/num
Deserialize small numbers as integers in arbitrary_precision
2022-01-15 16:52:34 -08:00
David Tolnay
d541381455
Deserialize small numbers as integers in arbitrary_precision 2022-01-15 16:44:37 -08:00
David Tolnay
0ca5a69d73
Add regression test for issue 845 2022-01-15 16:40:22 -08:00
David Tolnay
66919777d0
Disable buggy iter_not_returning_iterator lint
https://github.com/rust-lang/rust-clippy/issues/8285

    error: this method is named `iter` but its return type does not implement `Iterator`
       --> src/map.rs:238:5
        |
    238 |     pub fn iter(&self) -> Iter {
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: `-D clippy::iter-not-returning-iterator` implied by `-D clippy::pedantic`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_not_returning_iterator

    error: this method is named `iter_mut` but its return type does not implement `Iterator`
       --> src/map.rs:246:5
        |
    246 |     pub fn iter_mut(&mut self) -> IterMut {
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_not_returning_iterator
2022-01-14 18:59:32 -08:00
David Tolnay
aebe84cb09
Raise toolchain version for preserve_order to rust 1.46
Our indexmap dependency needs at least this version.

    error[E0658]: use of unstable library feature 'vec_drain_as_slice': recently added
        --> github.com-1ecc6299db9ec823/indexmap-1.8.0/src/map.rs:1182:30
         |
    1182 |         let iter = self.iter.as_slice().iter().map(Bucket::refs);
         |                              ^^^^^^^^

    error[E0658]: use of unstable library feature 'vec_drain_as_slice': recently added
       --> github.com-1ecc6299db9ec823/indexmap-1.8.0/src/set.rs:842:30
        |
    842 |         let iter = self.iter.as_slice().iter().map(Bucket::key_ref);
        |                              ^^^^^^^^
2022-01-07 18:37:31 -08:00
David Tolnay
3f459308f5
Set miriflags once for whole miri job 2022-01-03 12:01:56 -08:00
David Tolnay
c79d9ad2e1
Run miri also with some features enabled 2022-01-03 12:00:17 -08:00
David Tolnay
58d40de6ed
Release 1.0.74 v1.0.74 2022-01-01 12:13:38 -08:00
David Tolnay
ef7794f87f
Detect warnings in CI 2022-01-01 11:52:32 -08:00
David Tolnay
6de3d398ef
Merge pull request 841 from EFanZh/unsized-value-to-raw-value 2022-01-01 11:41:44 -08:00
EFanZh
012f567a38 Allow creating RawValues from references to unsized values 2022-01-01 19:03:16 +08:00
David Tolnay
18a88dad66
Avoid evaluating $c more than once in overflow macro 2021-12-30 21:43:05 -08:00
David Tolnay
5d2cbcdd4b
Eliminate lib module 2021-12-30 20:52:08 -08:00
David Tolnay
31198f589c
Switch to $(,)? in tri macro
The $(...)? operation is supported since Rust 1.32.
2021-12-30 19:50:01 -08:00
David Tolnay
51df12e0cd
Unconditionally import from alloc
Previously serde_json supported versions of rustc older than 1.36 which
didn't have a stable alloc crate. These days ever toolchain version we
support has alloc.
2021-12-30 19:44:15 -08:00
David Tolnay
95f67a0939
Ignore return_self_not_must_use clippy lint
error: missing `#[must_use]` attribute on a method returning `Self`
       --> src/map.rs:595:5
        |
    595 | /     pub fn and_modify<F>(self, f: F) -> Self
    596 | |     where
    597 | |         F: FnOnce(&mut Value),
    598 | |     {
    ...   |
    605 | |         }
    606 | |     }
        | |_____^
        |
        = note: `-D clippy::return-self-not-must-use` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use

    error: missing `#[must_use]` attribute on a method returning `Self`
       --> src/value/mod.rs:836:5
        |
    836 | /     pub fn take(&mut self) -> Value {
    837 | |         mem::replace(self, Value::Null)
    838 | |     }
        | |_____^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use
2021-12-17 18:22:32 -08:00
David Tolnay
296f718e18
Release 1.0.73 v1.0.73 2021-12-13 14:19:58 -08:00
David Tolnay
48455de674
Update to itoa 1.0 2021-12-12 10:53:01 -08:00
David Tolnay
b66b0eb322
Track raw pointers in miri CI run 2021-12-11 15:05:19 -08:00