Skip to content

Commit

Permalink
♻️ Use the "derive" feature of serde rather than serde_derive. (#164)
Browse files Browse the repository at this point in the history
This matches the serde crate's documentation on how to use derive.  It also avoids compile failures if new or existing dependencies add this feature to serde.
  • Loading branch information
jgalenson authored Oct 4, 2021
1 parent 2a13dbd commit b0b8bc7
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ xml-rs = "0.8"
thiserror = "1.0"

[dev-dependencies]
serde_derive = "1.0"
serde = { version = "1.0", features = ["derive"] }
simple_logger = "1.0"
docmatic = "0.1"
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
## Example usage

```rust
use serde;
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use serde_xml_rs::{from_str, to_string};

#[derive(Debug, Serialize, Deserialize, PartialEq)]
Expand Down
3 changes: 0 additions & 3 deletions src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ mod var;
///
/// ```rust
/// # #[macro_use]
/// # extern crate serde_derive;
/// # extern crate serde;
/// # extern crate serde_xml_rs;
/// # use serde_xml_rs::from_str;
Expand All @@ -45,7 +44,6 @@ pub fn from_str<'de, T: de::Deserialize<'de>>(s: &str) -> Result<T> {
///
/// ```rust
/// # #[macro_use]
/// # extern crate serde_derive;
/// # extern crate serde;
/// # extern crate serde_xml_rs;
/// # use serde_xml_rs::from_reader;
Expand Down Expand Up @@ -109,7 +107,6 @@ impl<'de, R: Read> RootDeserializer<R> {
///
/// ```rust
/// # #[macro_use]
/// # extern crate serde_derive;
/// # extern crate serde;
/// # extern crate serde_xml_rs;
/// # use serde_xml_rs::from_reader;
Expand Down
12 changes: 4 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
//! ## Basic example
//!
//! ```rust
//! use serde;
//! use serde_derive::{Deserialize, Serialize};
//! use serde::{Deserialize, Serialize};
//! use serde_xml_rs::{from_str, to_string};
//!
//! #[derive(Debug, Serialize, Deserialize, PartialEq)]
Expand All @@ -77,8 +76,7 @@
//! ## Tag contents
//!
//! ```rust
//! # use serde;
//! # use serde_derive::{Deserialize, Serialize};
//! # use serde::{self, Deserialize, Serialize};
//! # use serde_xml_rs::{from_str, to_string};
//!
//! #[derive(Debug, Serialize, Deserialize, PartialEq)]
Expand All @@ -102,8 +100,7 @@
//! ## Repeated tags
//!
//! ```rust
//! # use serde;
//! # use serde_derive::{Deserialize, Serialize};
//! # use serde::{self, Deserialize, Serialize};
//! # use serde_xml_rs::{from_str, to_string};
//!
//! #[derive(Debug, Serialize, Deserialize, PartialEq)]
Expand Down Expand Up @@ -160,8 +157,7 @@
//! ## Custom EventReader
//!
//! ```rust
//! use serde::Deserialize;
//! use serde_derive::{Deserialize, Serialize};
//! use serde::{Deserialize, Serialize};
//! use serde_xml_rs::{from_str, to_string, de::Deserializer};
//! use xml::reader::{EventReader, ParserConfig};
//!
Expand Down
5 changes: 1 addition & 4 deletions src/ser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ mod var;
///
/// ```rust
/// # #[macro_use]
/// # extern crate serde_derive;
/// # extern crate serde;
/// # extern crate serde_xml_rs;
/// # use serde_xml_rs::to_writer;
Expand Down Expand Up @@ -45,7 +44,6 @@ pub fn to_writer<W: Write, S: Serialize>(writer: W, value: &S) -> Result<()> {
///
/// ```rust
/// # #[macro_use]
/// # extern crate serde_derive;
/// # extern crate serde;
/// # extern crate serde_xml_rs;
/// # use serde_xml_rs::to_string;
Expand Down Expand Up @@ -291,8 +289,7 @@ where
mod tests {
use super::*;
use serde::ser::{SerializeMap, SerializeStruct};
use serde::Serializer as SerSerializer;
use serde_derive::Serialize;
use serde::{Serialize, Serializer as SerSerializer};

#[test]
fn test_serialize_bool() {
Expand Down
2 changes: 1 addition & 1 deletion tests/failures.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use log::info;
use serde_derive::Deserialize;
use serde::Deserialize;
use serde_xml_rs::from_str;
use simple_logger::SimpleLogger;

Expand Down
3 changes: 1 addition & 2 deletions tests/migrated.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use simple_logger::SimpleLogger;
use std::fmt::Debug;

use serde::{de, ser};
use serde_derive::{Deserialize, Serialize};
use serde::{de, ser, Deserialize, Serialize};
use serde_xml_rs::{from_str, Error};

fn init_logger() {
Expand Down
3 changes: 1 addition & 2 deletions tests/round_trip.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde::Deserialize;
use serde_derive::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use serde_xml_rs::{self, from_str, to_string, EventReader, ParserConfig};

#[derive(Debug, Serialize, Deserialize, PartialEq)]
Expand Down
1 change: 0 additions & 1 deletion tests/test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use serde::Deserialize;
use serde_derive::Deserialize;
use serde_xml_rs::{from_str, Deserializer};
use simple_logger::SimpleLogger;

Expand Down

0 comments on commit b0b8bc7

Please sign in to comment.