Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
args: --all-targets -- -D warnings
2 changes: 1 addition & 1 deletion src/de/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{error, fmt};
pub type Result<T> = core::result::Result<T, Error>;

/// This type represents all possible errors that can occur when deserializing JSON data
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum Error {
/// Control character (U+0000 to U+001F) found in string. Those must always be escaped.
Expand Down
14 changes: 8 additions & 6 deletions src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,8 @@ mod tests {
assert!(from_str::<[i32; 2]>("[0, 1,]").is_err());
}

#[allow(clippy::let_unit_value)]
#[allow(clippy::unit_cmp)]
#[test]
fn tuple() {
type Pair = (i64, i64);
Expand Down Expand Up @@ -1193,18 +1195,18 @@ mod tests {

#[test]
fn deserialize_optional_vector() {
#[derive(Debug, Deserialize, PartialEq)]
#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct Response {
pub log: Option<String>,
pub messages: Vec<Msg>,
}

#[derive(Debug, Deserialize, PartialEq, serde_derive::Serialize)]
#[derive(Debug, Deserialize, PartialEq, Eq, serde_derive::Serialize)]
pub struct Msg {
pub name: String,
}

#[derive(Debug, Deserialize, PartialEq)]
#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct OptIn {
pub name: Option<String>,
}
Expand Down Expand Up @@ -1264,20 +1266,20 @@ mod tests {

#[test]
fn deserialize_embedded_enum() {
#[derive(Debug, Deserialize, PartialEq)]
#[derive(Debug, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum MyResult {
Ok(Response),
Err(String),
}

#[derive(Debug, Deserialize, PartialEq)]
#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct Response {
pub log: Option<String>,
pub messages: Vec<Msg>,
}

#[derive(Debug, Deserialize, PartialEq)]
#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct Msg {
pub name: String,
pub amount: Option<String>,
Expand Down
5 changes: 3 additions & 2 deletions src/ser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ mod tests {
serde_json::to_string(&wrapped).unwrap()
);

#[allow(clippy::let_unit_value)]
let unit: Unit = ();
assert_eq!(to_string(&unit).unwrap(), "null");
assert_eq!(
Expand Down Expand Up @@ -1219,15 +1220,15 @@ mod tests {
fn serialize_embedded_enum() {
use serde_derive::Deserialize;

#[derive(Debug, Deserialize, Serialize, PartialEq)]
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum MyResult {
Unit(()),
Ok(Response),
Err(String),
}

#[derive(Debug, Deserialize, Serialize, PartialEq)]
#[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct Response {
pub log: Option<String>,
pub count: i64,
Expand Down