From 0b4ee7bfb285aa7c095ac050e2e0b8c659022113 Mon Sep 17 00:00:00 2001 From: Paul Woolcock Date: Fri, 25 Sep 2020 13:38:44 -0400 Subject: [PATCH] Various cleanup tasks * Remove old `extern crate` stmts * Remove rust-skeptic * Clean up Cargo.toml --- Cargo.toml | 15 +++++-------- build.rs | 20 ----------------- examples/follow_profile.rs | 3 --- examples/follows_me.rs | 3 --- examples/home_timeline.rs | 3 --- examples/print_your_profile.rs | 3 --- examples/search.rs | 3 --- examples/upload_photo.rs | 3 --- src/apps.rs | 1 + src/data.rs | 1 + src/entities/account.rs | 5 +++-- src/entities/attachment.rs | 1 + src/entities/card.rs | 1 + src/entities/context.rs | 1 + src/entities/filter.rs | 2 ++ src/entities/instance.rs | 1 + src/entities/list.rs | 1 + src/entities/mod.rs | 2 ++ src/entities/notification.rs | 1 + src/entities/push.rs | 4 ++++ src/entities/relationship.rs | 1 + src/entities/report.rs | 1 + src/entities/search_result.rs | 1 + src/entities/status.rs | 1 + src/errors.rs | 8 +++---- src/helpers/json.rs | 2 +- src/helpers/toml.rs | 12 +++++----- src/lib.rs | 40 ++++------------------------------ src/macros.rs | 21 ++++++++++-------- src/media_builder.rs | 1 + src/page.rs | 2 +- src/registration.rs | 1 + src/requests/filter.rs | 1 + src/requests/push.rs | 1 + src/requests/statuses.rs | 1 + src/scopes.rs | 6 ++--- src/status_builder.rs | 1 + tests/skeptic.rs | 1 - 38 files changed, 64 insertions(+), 112 deletions(-) delete mode 100644 build.rs delete mode 100644 tests/skeptic.rs diff --git a/Cargo.toml b/Cargo.toml index f2d6cd3..63fdef9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,22 +10,22 @@ keywords = ["api", "web", "social", "mastodon", "wrapper"] categories = ["web-programming", "web-programming::http-client", "api-bindings"] edition = "2018" + [dependencies] doc-comment = "0.3" +envy = { version = "0.4.0", optional = true } +hyper-old-types = "0.11.0" isolang = { version = "1.0", features = ["serde_serialize"] } +log = "0.4.6" reqwest = { version = "0.9", default-features = false } -serde = "1" -serde_derive = "1" +serde = { version = "1", features = ["derive"] } serde_json = "1" serde_urlencoded = "0.6.1" serde_qs = "0.6.0" url = "1" tap-reader = "1" -try_from = "0.3.2" toml = { version = "0.5.0", optional = true } -hyper-old-types = "0.11.0" -envy = { version = "0.4.0", optional = true } -log = "0.4.6" +try_from = "0.3.2" tungstenite = "0.10.1" [dependencies.chrono] @@ -39,9 +39,6 @@ env = ["envy"] all = ["toml", "json", "env"] rustls-tls = ["reqwest/rustls-tls"] -[build-dependencies] -skeptic = "0.13.3" - [dev-dependencies] skeptic = "0.13.3" tempfile = "3.0.3" diff --git a/build.rs b/build.rs deleted file mode 100644 index 34ca6e2..0000000 --- a/build.rs +++ /dev/null @@ -1,20 +0,0 @@ -#[cfg(feature = "toml")] -extern crate skeptic; - -#[cfg(feature = "toml")] -fn main() { - skeptic::generate_doc_tests(&["README.md"]); -} - -#[cfg(not(feature = "toml"))] -fn main() { - // tests/skeptic.rs still expects a file to be at OUT_DIR/skeptic-tests.rs, so - // make a dummy one - use std::{env, fs::OpenOptions, path::Path}; - let out_dir = Path::new(&env::var("OUT_DIR").expect("no out_dir set")).join("skeptic-tests.rs"); - OpenOptions::new() - .create(true) - .write(true) - .open(out_dir) - .expect("couldn't write to file"); -} diff --git a/examples/follow_profile.rs b/examples/follow_profile.rs index 2d97380..63a64cc 100644 --- a/examples/follow_profile.rs +++ b/examples/follow_profile.rs @@ -1,8 +1,5 @@ #![cfg_attr(not(feature = "toml"), allow(dead_code))] #![cfg_attr(not(feature = "toml"), allow(unused_imports))] -#[macro_use] -extern crate pretty_env_logger; -extern crate elefren; mod register; use crate::register::MastodonClient; diff --git a/examples/follows_me.rs b/examples/follows_me.rs index 2008fb5..bba8775 100644 --- a/examples/follows_me.rs +++ b/examples/follows_me.rs @@ -1,8 +1,5 @@ #![cfg_attr(not(feature = "toml"), allow(dead_code))] #![cfg_attr(not(feature = "toml"), allow(unused_imports))] -#[macro_use] -extern crate pretty_env_logger; -extern crate elefren; mod register; use crate::register::MastodonClient; diff --git a/examples/home_timeline.rs b/examples/home_timeline.rs index 0f3c920..d3c5b38 100644 --- a/examples/home_timeline.rs +++ b/examples/home_timeline.rs @@ -1,8 +1,5 @@ #![cfg_attr(not(feature = "toml"), allow(dead_code))] #![cfg_attr(not(feature = "toml"), allow(unused_imports))] -#[macro_use] -extern crate pretty_env_logger; -extern crate elefren; mod register; use crate::register::MastodonClient; diff --git a/examples/print_your_profile.rs b/examples/print_your_profile.rs index 126110a..b30d596 100644 --- a/examples/print_your_profile.rs +++ b/examples/print_your_profile.rs @@ -1,8 +1,5 @@ #![cfg_attr(not(feature = "toml"), allow(dead_code))] #![cfg_attr(not(feature = "toml"), allow(unused_imports))] -#[macro_use] -extern crate pretty_env_logger; -extern crate elefren; mod register; use crate::register::MastodonClient; diff --git a/examples/search.rs b/examples/search.rs index c619a74..3981375 100644 --- a/examples/search.rs +++ b/examples/search.rs @@ -1,8 +1,5 @@ #![cfg_attr(not(feature = "toml"), allow(dead_code))] #![cfg_attr(not(feature = "toml"), allow(unused_imports))] -#[macro_use] -extern crate pretty_env_logger; -extern crate elefren; mod register; use crate::register::MastodonClient; diff --git a/examples/upload_photo.rs b/examples/upload_photo.rs index fa2dee9..fa4aefa 100644 --- a/examples/upload_photo.rs +++ b/examples/upload_photo.rs @@ -1,8 +1,5 @@ #![cfg_attr(not(feature = "toml"), allow(dead_code))] #![cfg_attr(not(feature = "toml"), allow(unused_imports))] -#[macro_use] -extern crate pretty_env_logger; -extern crate elefren; mod register; use crate::register::MastodonClient; diff --git a/src/apps.rs b/src/apps.rs index aa4899b..98fae0d 100644 --- a/src/apps.rs +++ b/src/apps.rs @@ -1,5 +1,6 @@ use std::borrow::Cow; +use serde::Serialize; use try_from::TryInto; use crate::errors::{Error, Result}; diff --git a/src/data.rs b/src/data.rs index 20dfd69..1015725 100644 --- a/src/data.rs +++ b/src/data.rs @@ -1,4 +1,5 @@ use std::borrow::Cow; +use serde::{Serialize, Deserialize}; /// Raw data about mastodon app. Save `Data` using `serde` to prevent needing /// to authenticate on every run. diff --git a/src/entities/account.rs b/src/entities/account.rs index e9c5e4e..a686b17 100644 --- a/src/entities/account.rs +++ b/src/entities/account.rs @@ -1,7 +1,8 @@ //! A module containing everything relating to a account returned from the api. use chrono::prelude::*; -use serde::de::{self, Deserialize, Deserializer, Unexpected}; +use serde::{Deserialize, Serialize}; +use serde::de::{self, Unexpected}; use crate::status_builder; use std::path::PathBuf; @@ -79,7 +80,7 @@ pub struct Source { fields: Option>, } -fn string_or_bool<'de, D: Deserializer<'de>>(val: D) -> ::std::result::Result { +fn string_or_bool<'de, D: de::Deserializer<'de>>(val: D) -> ::std::result::Result { #[derive(Clone, Debug, Deserialize, PartialEq)] #[serde(untagged)] pub enum BoolOrString { diff --git a/src/entities/attachment.rs b/src/entities/attachment.rs index 740db19..ce2fbdd 100644 --- a/src/entities/attachment.rs +++ b/src/entities/attachment.rs @@ -1,4 +1,5 @@ //! Module containing everything related to media attachements. +use serde::Deserialize; /// A struct representing a media attachment. #[derive(Debug, Clone, Deserialize, PartialEq)] diff --git a/src/entities/card.rs b/src/entities/card.rs index ec9471c..776a810 100644 --- a/src/entities/card.rs +++ b/src/entities/card.rs @@ -1,4 +1,5 @@ //! Module representing cards of statuses. +use serde::Deserialize; /// A card of a status. #[derive(Debug, Clone, Deserialize, PartialEq)] diff --git a/src/entities/context.rs b/src/entities/context.rs index 60a4ea2..271f46c 100644 --- a/src/entities/context.rs +++ b/src/entities/context.rs @@ -1,4 +1,5 @@ //! A module about contexts of statuses. +use serde::Deserialize; use super::status::Status; diff --git a/src/entities/filter.rs b/src/entities/filter.rs index 29dcb27..1f7232b 100644 --- a/src/entities/filter.rs +++ b/src/entities/filter.rs @@ -1,3 +1,5 @@ +use serde::{Serialize, Deserialize}; + /// Represents a single Filter #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Filter { diff --git a/src/entities/instance.rs b/src/entities/instance.rs index 66d60ca..3d2e464 100644 --- a/src/entities/instance.rs +++ b/src/entities/instance.rs @@ -1,4 +1,5 @@ //! Module containing everything related to an instance. +use serde::Deserialize; use super::account::Account; /// A struct containing info of an instance. diff --git a/src/entities/list.rs b/src/entities/list.rs index 8d640c8..2bee202 100644 --- a/src/entities/list.rs +++ b/src/entities/list.rs @@ -1,3 +1,4 @@ +use serde::Deserialize; /// Used for ser/de of list resources #[derive(Clone, Debug, Deserialize, PartialEq)] pub struct List { diff --git a/src/entities/mod.rs b/src/entities/mod.rs index d5ad373..14e04ac 100644 --- a/src/entities/mod.rs +++ b/src/entities/mod.rs @@ -1,3 +1,5 @@ +use serde::Deserialize; + /// Data structures for ser/de of account-related resources pub mod account; /// Data structures for ser/de of attachment-related resources diff --git a/src/entities/notification.rs b/src/entities/notification.rs index 6ad4c37..9ad0d88 100644 --- a/src/entities/notification.rs +++ b/src/entities/notification.rs @@ -1,5 +1,6 @@ //! Module containing all info about notifications. +use serde::Deserialize; use super::{account::Account, status::Status}; use chrono::prelude::*; diff --git a/src/entities/push.rs b/src/entities/push.rs index bcf826a..b277c8d 100644 --- a/src/entities/push.rs +++ b/src/entities/push.rs @@ -1,3 +1,5 @@ +use serde::{Deserialize, Serialize}; + /// Represents the `alerts` key of the `Subscription` object #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default)] pub struct Alerts { @@ -25,6 +27,7 @@ pub struct Subscription { } pub(crate) mod add_subscription { + use serde::Serialize; use super::Alerts; #[derive(Debug, Clone, PartialEq, Serialize, Default)] @@ -52,6 +55,7 @@ pub(crate) mod add_subscription { } pub(crate) mod update_data { + use serde::Serialize; use super::Alerts; #[derive(Debug, Clone, PartialEq, Serialize, Default)] diff --git a/src/entities/relationship.rs b/src/entities/relationship.rs index 35f3c99..df3fa51 100644 --- a/src/entities/relationship.rs +++ b/src/entities/relationship.rs @@ -1,5 +1,6 @@ //! module containing everything relating to a relationship with //! another account. +use serde::Deserialize; /// A struct containing information about a relationship with another account. #[derive(Debug, Clone, Deserialize, PartialEq)] diff --git a/src/entities/report.rs b/src/entities/report.rs index 2c3411b..017a754 100644 --- a/src/entities/report.rs +++ b/src/entities/report.rs @@ -1,4 +1,5 @@ //! module containing information about a finished report of a user. +use serde::Deserialize; /// A struct containing info about a report. #[derive(Debug, Clone, Deserialize, PartialEq)] diff --git a/src/entities/search_result.rs b/src/entities/search_result.rs index d2df4c3..2c3a5c4 100644 --- a/src/entities/search_result.rs +++ b/src/entities/search_result.rs @@ -1,4 +1,5 @@ //! A module containing info relating to a search result. +use serde::Deserialize; use super::{ prelude::{Account, Status}, diff --git a/src/entities/status.rs b/src/entities/status.rs index 2cc596b..95f307b 100644 --- a/src/entities/status.rs +++ b/src/entities/status.rs @@ -4,6 +4,7 @@ use super::prelude::*; use chrono::prelude::*; use crate::entities::card::Card; use crate::status_builder::Visibility; +use serde::Deserialize; /// A status from the instance. #[derive(Debug, Clone, Deserialize, PartialEq)] diff --git a/src/errors.rs b/src/errors.rs index f0d61c9..49a53b6 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,4 +1,5 @@ use std::{error, fmt, io::Error as IoError}; +use serde::Deserialize; #[cfg(feature = "env")] use envy::Error as EnvyError; @@ -8,9 +9,9 @@ use serde_json::Error as SerdeError; use serde_qs::Error as SerdeQsError; use serde_urlencoded::ser::Error as UrlEncodedError; #[cfg(feature = "toml")] -use crate::tomlcrate::de::Error as TomlDeError; +use ::toml::de::Error as TomlDeError; #[cfg(feature = "toml")] -use crate::tomlcrate::ser::Error as TomlSerError; +use ::toml::ser::Error as TomlSerError; use url::ParseError as UrlError; use tungstenite::error::Error as WebSocketError; @@ -237,8 +238,7 @@ mod tests { #[cfg(feature = "toml")] #[test] fn from_toml_de_error() { - use crate::tomlcrate; - let err: TomlDeError = tomlcrate::from_str::<()>("not valid toml").unwrap_err(); + let err: TomlDeError = ::toml::from_str::<()>("not valid toml").unwrap_err(); let err: Error = Error::from(err); assert_is!(err, Error::TomlDe(..)); } diff --git a/src/helpers/json.rs b/src/helpers/json.rs index e861585..c3c885f 100644 --- a/src/helpers/json.rs +++ b/src/helpers/json.rs @@ -83,7 +83,7 @@ mod tests { use std::{fs::OpenOptions, io::Cursor}; use tempfile::{tempdir, NamedTempFile}; - const DOC: &'static str = indoc!( + const DOC: &'static str = indoc::indoc!( r#" { "base": "https://example.com", diff --git a/src/helpers/toml.rs b/src/helpers/toml.rs index 4d23057..11f4822 100644 --- a/src/helpers/toml.rs +++ b/src/helpers/toml.rs @@ -4,19 +4,17 @@ use std::{ path::Path, }; -use crate::tomlcrate; - use crate::data::Data; use crate::Result; /// Attempts to deserialize a Data struct from a string pub fn from_str(s: &str) -> Result { - Ok(tomlcrate::from_str(s)?) + Ok(toml::from_str(s)?) } /// Attempts to deserialize a Data struct from a slice of bytes pub fn from_slice(s: &[u8]) -> Result { - Ok(tomlcrate::from_slice(s)?) + Ok(toml::from_slice(s)?) } /// Attempts to deserialize a Data struct from something that implements @@ -36,12 +34,12 @@ pub fn from_file>(path: P) -> Result { /// Attempts to serialize a Data struct to a String pub fn to_string(data: &Data) -> Result { - Ok(tomlcrate::to_string_pretty(data)?) + Ok(toml::to_string_pretty(data)?) } /// Attempts to serialize a Data struct to a Vec of bytes pub fn to_vec(data: &Data) -> Result> { - Ok(tomlcrate::to_vec(data)?) + Ok(toml::to_vec(data)?) } /// Attempts to serialize a Data struct to something that implements the @@ -83,7 +81,7 @@ mod tests { use std::{fs::OpenOptions, io::Cursor}; use tempfile::{tempdir, NamedTempFile}; - const DOC: &'static str = indoc!( + const DOC: &'static str = indoc::indoc!( r#" base = "https://example.com" client_id = "adbc01234" diff --git a/src/lib.rs b/src/lib.rs index 4504f8b..413a02c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -69,40 +69,7 @@ unused_import_braces, unused_qualifications )] -#![allow(intra_doc_link_resolution_failure)] - -#[macro_use] -extern crate log; -#[macro_use] -extern crate serde_derive; -#[macro_use] -extern crate doc_comment; -extern crate hyper_old_types; -extern crate isolang; -#[macro_use] -extern crate serde_json; -extern crate chrono; -extern crate reqwest; -extern crate serde; -extern crate serde_qs; -extern crate serde_urlencoded; -extern crate tap_reader; -extern crate try_from; -extern crate url; -extern crate tungstenite; - -#[cfg(feature = "env")] -extern crate envy; - -#[cfg(feature = "toml")] -extern crate toml as tomlcrate; - -#[cfg(test)] -extern crate tempfile; - -#[cfg(test)] -#[cfg_attr(all(test, any(feature = "toml", feature = "json")), macro_use)] -extern crate indoc; +#![allow(broken_intra_doc_links)] use std::{ borrow::Cow, @@ -724,6 +691,7 @@ impl EventReader { event = event_line[6..].trim().to_string(); data = lines.iter().find(|line| line.starts_with("data:")).map(|x| x[5..].trim().to_string()); } else { + use serde::Deserialize; #[derive(Deserialize)] struct Message { pub event: String, @@ -891,13 +859,13 @@ fn deserialise serde::Deserialize<'de>>(response: Response) -> Resul match serde_json::from_reader(&mut reader) { Ok(t) => { - debug!("{}", String::from_utf8_lossy(&reader.bytes)); + log::debug!("{}", String::from_utf8_lossy(&reader.bytes)); Ok(t) }, // If deserializing into the desired type fails try again to // see if this is an error response. Err(e) => { - error!("{}", String::from_utf8_lossy(&reader.bytes)); + log::error!("{}", String::from_utf8_lossy(&reader.bytes)); if let Ok(error) = serde_json::from_slice(&reader.bytes) { return Err(Error::Api(error)); } diff --git a/src/macros.rs b/src/macros.rs index 8ee6623..c6d031d 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -17,7 +17,7 @@ macro_rules! methods { macro_rules! paged_routes { (($method:ident) $name:ident: $url:expr => $ret:ty, $($rest:tt)*) => { - doc_comment! { + doc_comment::doc_comment! { concat!( "Equivalent to `", stringify!($method), " /api/v1/", $url, @@ -55,7 +55,7 @@ macro_rules! paged_routes { }; ((get ($($(#[$m:meta])* $param:ident: $typ:ty,)*)) $name:ident: $url:expr => $ret:ty, $($rest:tt)*) => { - doc_comment! { + doc_comment::doc_comment! { concat!( "Equivalent to `get /api/v1/", $url, @@ -63,6 +63,7 @@ macro_rules! paged_routes { ), fn $name<'a>(&self, $($param: $typ,)*) -> Result> { use serde_urlencoded; + use serde::Serialize; #[derive(Serialize)] struct Data<'a> { @@ -103,7 +104,7 @@ macro_rules! paged_routes { macro_rules! route_v2 { ((get ($($param:ident: $typ:ty,)*)) $name:ident: $url:expr => $ret:ty, $($rest:tt)*) => { - doc_comment! { + doc_comment::doc_comment! { concat!( "Equivalent to `get /api/v2/", $url, @@ -111,6 +112,7 @@ macro_rules! route_v2 { ), fn $name<'a>(&self, $($param: $typ,)*) -> Result<$ret> { use serde_urlencoded; + use serde::Serialize; #[derive(Serialize)] struct Data<'a> { @@ -145,7 +147,7 @@ macro_rules! route_v2 { macro_rules! route { ((get ($($param:ident: $typ:ty,)*)) $name:ident: $url:expr => $ret:ty, $($rest:tt)*) => { - doc_comment! { + doc_comment::doc_comment! { concat!( "Equivalent to `get /api/v1/", $url, @@ -153,6 +155,7 @@ macro_rules! route { ), fn $name<'a>(&self, $($param: $typ,)*) -> Result<$ret> { use serde_urlencoded; + use serde::Serialize; #[derive(Serialize)] struct Data<'a> { @@ -182,7 +185,7 @@ macro_rules! route { }; (($method:ident ($($param:ident: $typ:ty,)*)) $name:ident: $url:expr => $ret:ty, $($rest:tt)*) => { - doc_comment! { + doc_comment::doc_comment! { concat!( "Equivalent to `", stringify!($method), " /api/v1/", $url, @@ -190,7 +193,7 @@ macro_rules! route { ), fn $name(&self, $($param: $typ,)*) -> Result<$ret> { - let form_data = json!({ + let form_data = serde_json::json!({ $( stringify!($param): $param, )* @@ -217,7 +220,7 @@ macro_rules! route { }; (($method:ident) $name:ident: $url:expr => $ret:ty, $($rest:tt)*) => { - doc_comment! { + doc_comment::doc_comment! { concat!( "Equivalent to `", stringify!($method), " /api/v1/", $url, @@ -255,7 +258,7 @@ macro_rules! route_id { ($(($method:ident) $name:ident: $url:expr => $ret:ty,)*) => { $( - doc_comment! { + doc_comment::doc_comment! { concat!( "Equivalent to `", stringify!($method), " /api/v1/", $url, @@ -289,7 +292,7 @@ macro_rules! route_id { macro_rules! paged_routes_with_id { (($method:ident) $name:ident: $url:expr => $ret:ty, $($rest:tt)*) => { - doc_comment! { + doc_comment::doc_comment! { concat!( "Equivalent to `", stringify!($method), " /api/v1/", $url, diff --git a/src/media_builder.rs b/src/media_builder.rs index 5cd7639..eab9c94 100644 --- a/src/media_builder.rs +++ b/src/media_builder.rs @@ -1,4 +1,5 @@ use std::borrow::Cow; +use serde::Serialize; /// A builder pattern struct for constructing a media attachment. #[derive(Debug, Default, Clone, Serialize)] diff --git a/src/page.rs b/src/page.rs index 06c76bd..67fb340 100644 --- a/src/page.rs +++ b/src/page.rs @@ -11,7 +11,7 @@ macro_rules! pages { ($($direction:ident: $fun:ident),*) => { $( - doc_comment!(concat!( + doc_comment::doc_comment!(concat!( "Method to retrieve the ", stringify!($direction), " page of results"), pub fn $fun(&mut self) -> Result>> { let url = match self.$direction.take() { diff --git a/src/registration.rs b/src/registration.rs index c6b8876..d2984d5 100644 --- a/src/registration.rs +++ b/src/registration.rs @@ -1,6 +1,7 @@ use std::borrow::Cow; use reqwest::{Client, RequestBuilder, Response}; +use serde::Deserialize; use try_from::TryInto; use url::percent_encoding::{utf8_percent_encode, DEFAULT_ENCODE_SET}; diff --git a/src/requests/filter.rs b/src/requests/filter.rs index db619e4..bdbe54c 100644 --- a/src/requests/filter.rs +++ b/src/requests/filter.rs @@ -1,5 +1,6 @@ use crate::entities::filter::FilterContext; use std::time::Duration; +use serde::Serialize; /// Form used to create a filter /// diff --git a/src/requests/push.rs b/src/requests/push.rs index 28aa3c0..8540d04 100644 --- a/src/requests/push.rs +++ b/src/requests/push.rs @@ -1,5 +1,6 @@ use crate::entities::push::{add_subscription, update_data}; use crate::errors::Result; +use serde::Serialize; /// Container for the key & auth strings for an AddPushRequest /// diff --git a/src/requests/statuses.rs b/src/requests/statuses.rs index 1f1e587..8c8e9dc 100644 --- a/src/requests/statuses.rs +++ b/src/requests/statuses.rs @@ -1,6 +1,7 @@ use crate::errors::Error; use serde_qs; use std::{borrow::Cow, convert::Into}; +use serde::Serialize; mod bool_qs_serialize { use serde::Serializer; diff --git a/src/scopes.rs b/src/scopes.rs index a857b95..1fd8a87 100644 --- a/src/scopes.rs +++ b/src/scopes.rs @@ -6,10 +6,8 @@ use std::{ str::FromStr, }; -use serde::ser::{Serialize, Serializer}; - use crate::errors::Error; -use serde::{Deserialize, Deserializer}; +use serde::{Deserialize, Deserializer, Serialize}; use serde::de::{self, Visitor}; /// Represents a set of OAuth scopes @@ -47,7 +45,7 @@ impl FromStr for Scopes { impl Serialize for Scopes { fn serialize(&self, serializer: S) -> ::std::result::Result where - S: Serializer, + S: serde::ser::Serializer, { let repr = format!("{}", self); serializer.serialize_str(&repr) diff --git a/src/status_builder.rs b/src/status_builder.rs index 15a24eb..1e62489 100644 --- a/src/status_builder.rs +++ b/src/status_builder.rs @@ -1,4 +1,5 @@ use isolang::Language; +use serde::{Deserialize, Serialize}; /// A builder pattern struct for constructing a status. /// diff --git a/tests/skeptic.rs b/tests/skeptic.rs deleted file mode 100644 index ff46c9c..0000000 --- a/tests/skeptic.rs +++ /dev/null @@ -1 +0,0 @@ -include!(concat!(env!("OUT_DIR"), "/skeptic-tests.rs"));