Commit Graph

3816 Commits

Author SHA1 Message Date
David Tolnay
fccb9499bc
Release 1.0.163 2023-05-10 00:47:53 -07:00
David Tolnay
a139ab2572
Adjust PR 2446 with less overgeneralized name 2023-05-10 00:45:52 -07:00
David Tolnay
1d910a484c
Format with rustfmt 1.5.2-nightly 2023-05-10 00:40:39 -07:00
David Tolnay
ee9166ec97
Revise comments on the FlatMapDeserializer entry taker 2023-05-10 00:39:10 -07:00
David Tolnay
b5a9eff32e
Resolve while_let_on_iterator clippy lint
warning: this loop could be written as a `for` loop
        --> serde/src/private/de.rs:2905:9
         |
    2905 |         while let Some(item) = self.iter.next() {
         |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for item in self.iter.by_ref()`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator
         = note: `#[warn(clippy::while_let_on_iterator)]` on by default
2023-05-10 00:23:38 -07:00
David Tolnay
9441a29663
Merge pull request #2446 from Mingun/dedup2
Eliminate some duplicated code
2023-05-10 00:13:44 -07:00
Mingun
ab6588ef74 Extract duplicated code into a function 2023-05-08 10:39:30 +05:00
Mingun
1d11f03449 Extract logic of taking flattened fields into a function 2023-05-08 10:39:27 +05:00
Mingun
e11d01fe1d Remove constructors for FlatMapAccess and FlatStructAccess
They are used only in one place each, so for simplifying understanding it is better to inline them
2023-05-08 09:40:06 +05:00
Mingun
a901f50850 FlatMapAccess and FlatStructAccess does not need to be public 2023-05-08 09:37:15 +05:00
Mingun
c399e9c368 Remove FlatInternallyTaggedAccess because it is the same as FlatMapAccess 2023-05-08 09:25:18 +05:00
David Tolnay
25381be0c9
Merge pull request #2442 from taiki-e/derive-build-script
Remove build script from serde_derive
2023-05-05 14:35:09 -07:00
Taiki Endo
ef2a7c753f Remove build script from serde_derive
The current serde_derive's MSRV is 1.56, and both underscore consts and
ptr::addr_of! are always available.
2023-05-06 05:34:38 +09:00
David Tolnay
99f165b45a
Release 1.0.162 2023-05-04 18:46:55 -07:00
David Tolnay
2fb5560746
Attempt to generate just one copy of TagContentOtherFieldVisitor's field matching 2023-05-04 18:42:21 -07:00
David Tolnay
bd653ab30c
Format PR 2377 with rustfmt 2023-05-04 18:42:21 -07:00
David Tolnay
b5d68aedaa
Merge pull request #2377 from mfro/master
Allow bytes for adjacently tagged enums
2023-05-04 18:39:57 -07:00
David Tolnay
624879c4c6
Merge pull request #2441 from dtolnay/test
Reimplement tests that touched serde_test internal API
2023-05-04 17:42:07 -07:00
David Tolnay
bd9e9abf35
Reimplement tests that touched serde_test internal API 2023-05-04 17:38:58 -07:00
David Tolnay
3e4a23cbd0
Release 1.0.161 2023-05-04 16:45:18 -07:00
David Tolnay
6326ceec3f
Don't panic in serde_test on running out of tokens 2023-05-04 16:38:20 -07:00
David Tolnay
8f4d37c7ec
Convert serde_test's assert_next_token from macro to function 2023-05-04 16:34:14 -07:00
David Tolnay
1b8290b318
Convert serde_test's unexpected from macro to function 2023-05-04 16:30:34 -07:00
David Tolnay
48193fbccd
Merge pull request #2435 from Mingun/hitchhiker-guide
Don't panic in serde_test
2023-05-04 16:27:35 -07:00
Mingun
51799dd654 Allow to flatten IgnoredAny to ignore any additional data
Although any additional fields in struct by default are ignored, sometimes
this can be useful, if you use generic structures, for example
2023-04-30 01:59:55 +05:00
Mingun
732ac49321 Implement PartialEq for IgnoredAny so it can be used in tests 2023-04-30 01:58:07 +05:00
Mingun
ac8ea72d88 Don't panic in serde_test
Panics lead to reporting errors in tests inside of serde_test internals,
returning errors moves the report location to the corresponding assert_tokens
expression
2023-04-30 00:06:51 +05:00
David Tolnay
f583401284
Merge pull request #2433 from Mingun/rm-gitattributes
Remove unused after .gitattributes
2023-04-26 12:04:04 -07:00
Mingun
2d88228b7d Remove unused after a649190a4d .gitattributes 2023-04-26 23:54:09 +05:00
David Tolnay
0c6a2bbf79
Release 1.0.160 2023-04-10 22:15:49 -07:00
David Tolnay
a80d830f27
Merge pull request #2426 from compiler-errors/dont-doc-private
Make derived serializer/deserializer internals `doc(hidden)`
2023-04-10 22:12:35 -07:00
Michael Goulet
5f3fd9994e Make serializer/deserializer internals doc(hidden) 2023-04-10 21:41:50 -07:00
David Tolnay
d6de911855
Release 1.0.159 2023-03-27 22:05:58 -07:00
David Tolnay
04af32230e
Merge pull request #2422 from dtolnay/emptyattr
Accept empty #[serde()] attribute
2023-03-27 22:05:18 -07:00
David Tolnay
4cb8d079f8
Accept empty #[serde()] attribute 2023-03-27 22:00:46 -07:00
David Tolnay
6ab55a1e52
Add regression test for issue 2415
Currently fails:

    error: unexpected end of input, unexpected token in nested attribute, expected ident
     --> test_suite/tests/regression/issue2415.rs:4:9
      |
    4 | #[serde()]
      |         ^
2023-03-27 22:00:01 -07:00
David Tolnay
acfd19cb46
Release serde_derive_internals 0.27.0 2023-03-20 04:32:49 -07:00
David Tolnay
e3058105f0
Release 1.0.158 2023-03-20 04:24:27 -07:00
David Tolnay
dc200a6450
Reformat comments of non-public serde_derive internals
Fixes these being treated as "tests" by `cargo test` in serde_derive:

    running 3 tests
    test src/internals/check.rs - internals::check::check_remote_generic (line 23) ... FAILED
    test src/internals/check.rs - internals::check::check_remote_generic (line 29) ... FAILED
    test src/lib.rs - (line 3) ... ok

    failures:

    ---- src/internals/check.rs - internals::check::check_remote_generic (line 23) stdout ----
    error: unknown start of token: \u{2026}
     --> src/internals/check.rs:25:20
      |
    4 | struct Generic<T> {…}
      |                    ^

    error: cannot find attribute `serde` in this scope
     --> src/internals/check.rs:24:3
      |
    3 | #[serde(remote = "Generic")]
      |   ^^^^^
      |
      = note: `serde` is in scope, but it is a crate, not an attribute

    error[E0392]: parameter `T` is never used
     --> src/internals/check.rs:25:16
      |
    4 | struct Generic<T> {…}
      |                ^ unused parameter
      |
      = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
      = help: if you intended `T` to be a const parameter, use `const T: usize` instead

    ---- src/internals/check.rs - internals::check::check_remote_generic (line 29) stdout ----
    error: unknown start of token: \u{2026}
     --> src/internals/check.rs:31:21
      |
    4 | struct ConcreteDef {…}
      |                     ^

    error: cannot find attribute `serde` in this scope
     --> src/internals/check.rs:30:3
      |
    3 | #[serde(remote = "Generic<T>")]
      |   ^^^^^
      |
      = note: `serde` is in scope, but it is a crate, not an attribute
2023-03-20 04:23:46 -07:00
David Tolnay
2c0999a0b9
Merge pull request #2410 from serde-rs/attrvalue
Check for None-delimited group in attribute value
2023-03-20 04:23:33 -07:00
David Tolnay
dd460f82a1
Check for None-delimited group in attribute value 2023-03-20 04:16:52 -07:00
David Tolnay
c3d637f397
Add regression test for issue 2409 2023-03-20 03:59:43 -07:00
David Tolnay
479a00a215
Release 1.0.157 2023-03-17 17:35:09 -07:00
David Tolnay
c42e7c8012
Reflect serde_derive required compiler in build script and rust-version metadata 2023-03-17 17:34:46 -07:00
David Tolnay
5b8e0657d4
Ignore single_match_else pedantic clippy lint in serde_derive_internals
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
        --> serde_derive_internals/src/attr.rs:1412:8
         |
    1412 |       Ok(match string.parse() {
         |  ________^
    1413 | |         Ok(path) => Some(path),
    1414 | |         Err(_) => {
    1415 | |             cx.error_spanned_by(
    ...    |
    1420 | |         }
    1421 | |     })
         | |_____^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
         = note: `-D clippy::single-match-else` implied by `-D clippy::pedantic`
    help: try this
         |
    1412 ~     Ok(if let Ok(path) = string.parse() { Some(path) } else {
    1413 +         cx.error_spanned_by(
    1414 +             &string,
    1415 +             format!("failed to parse path: {:?}", string.value()),
    1416 +         );
    1417 +         None
    1418 ~     })
         |

    error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
        --> serde_derive_internals/src/attr.rs:1434:8
         |
    1434 |       Ok(match string.parse() {
         |  ________^
    1435 | |         Ok(expr) => Some(expr),
    1436 | |         Err(_) => {
    1437 | |             cx.error_spanned_by(
    ...    |
    1442 | |         }
    1443 | |     })
         | |_____^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
    help: try this
         |
    1434 ~     Ok(if let Ok(expr) = string.parse() { Some(expr) } else {
    1435 +         cx.error_spanned_by(
    1436 +             &string,
    1437 +             format!("failed to parse path: {:?}", string.value()),
    1438 +         );
    1439 +         None
    1440 ~     })
         |

    error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
        --> serde_derive_internals/src/attr.rs:1478:8
         |
    1478 |       Ok(match string.parse() {
         |  ________^
    1479 | |         Ok(ty) => Some(ty),
    1480 | |         Err(_) => {
    1481 | |             cx.error_spanned_by(
    ...    |
    1486 | |         }
    1487 | |     })
         | |_____^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
    help: try this
         |
    1478 ~     Ok(if let Ok(ty) = string.parse() { Some(ty) } else {
    1479 +         cx.error_spanned_by(
    1480 +             &string,
    1481 +             format!("failed to parse type: {} = {:?}", attr_name, string.value()),
    1482 +         );
    1483 +         None
    1484 ~     })
         |
2023-03-17 17:32:50 -07:00
David Tolnay
9fc0d13e2c
Merge pull request #2406 from dtolnay/nestedmeta
Rewrite attribute parser using parse_nested_meta
2023-03-17 17:32:39 -07:00
David Tolnay
bc22641359
Rewrite attribute parser using parse_nested_meta 2023-03-17 17:23:56 -07:00
David Tolnay
05098105a8
Update compiler version for serde_derive in readme 2023-03-17 17:23:33 -07:00
David Tolnay
5b23634dc6
Merge pull request #2405 from dtolnay/syn
Update to syn 2
2023-03-17 17:23:20 -07:00
David Tolnay
32f0d00ff9
Update to syn 2 2023-03-17 17:17:40 -07:00