Skip to content

Commit

Permalink
Fix clippy, bump version.
Browse files Browse the repository at this point in the history
  • Loading branch information
samscott89 committed Mar 2, 2023
1 parent 096d851 commit 8a13b67
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT/Apache-2.0"
name = "serde_qs"
repository = "https://github.com/samscott89/serde_qs"
readme = "README.md"
version = "0.11.0"
version = "0.12.0"
rust-version = "1.36"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This crate works with Cargo and can be found on

```toml
[dependencies]
serde_qs = "0.11"
serde_qs = "0.12"
```

Minimum supported Rust version is 1.36.
Expand Down
20 changes: 20 additions & 0 deletions tests/test_deserialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ fn deserialize_map_with_int_keys() {

#[test]
fn deserialize_unit_types() {
// allow these clippy lints cause I like how explicit the test is
#![allow(clippy::let_unit_value)]
#![allow(clippy::unit_cmp)]

#[derive(Debug, Deserialize, PartialEq)]
struct A;
#[derive(Debug, Deserialize, PartialEq)]
Expand All @@ -722,3 +726,19 @@ fn deserialize_unit_types() {
let test: B = serde_qs::from_str("t=&a=test").unwrap();
assert_eq!(test, B { t: (), a: "test" });
}

#[test]
fn serialization_roundtrip() {
#[derive(Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
struct Data {
#[serde(default)]
values: Vec<String>,
}

let data = Data { values: Vec::new() };
let serialized = serde_qs::to_string(&data).unwrap();

dbg!(&serialized);
let deserialized = serde_qs::from_str::<Data>(&serialized).unwrap();
assert_eq!(deserialized, data);
}
2 changes: 2 additions & 0 deletions tests/test_serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ fn test_serializer_unit() {
let mut writer = Vec::new();
{
let serializer = &mut qs::Serializer::new(&mut writer);
// allow this clippy lints cause I like how explicit the test is
#[allow(clippy::let_unit_value)]
let q = ();
q.serialize(serializer).unwrap();
}
Expand Down

0 comments on commit 8a13b67

Please sign in to comment.