Merge pull request #317 from elichai/2019-08-serde

Remove serde-derive as a dependency
This commit is contained in:
Andrew Poelstra 2019-08-20 18:17:22 +00:00 committed by GitHub
commit 8ff904c747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 18 deletions

View File

@ -1,4 +1,5 @@
language: rust
cache: cargo
addons:
apt:
@ -17,11 +18,13 @@ addons:
matrix:
include:
- rust: stable
env: DO_FUZZ=true DO_COV=true
env: DO_FUZZ=true DO_COV=true AS_DEPENDENCY=true
- rust: beta
env: AS_DEPENDENCY=true
- rust: nightly
env: DO_BENCH=true
env: DO_BENCH=true AS_DEPENDENCY=true
- rust: 1.22.0
env: AS_DEPENDENCY=true
script:
- ./contrib/test.sh

View File

@ -1,6 +1,6 @@
[package]
name = "bitcoin"
version = "0.19.1"
version = "0.19.2"
authors = ["Andrew Poelstra <apoelstra@wpsoftware.net>"]
license = "CC0-1.0"
homepage = "https://github.com/rust-bitcoin/rust-bitcoin/"
@ -25,18 +25,13 @@ byteorder = "1.2"
bitcoin_hashes = "0.7"
bitcoinconsensus = { version = "0.16", optional = true }
secp256k1 = "0.12"
[dependencies.serde]
version = "=1.0.98"
features = ["derive"]
optional = true
serde = { version = "1", optional = true }
[dependencies.hex]
version = "=0.3.2"
[dev-dependencies]
serde_derive = "=1.0.98"
serde_derive = "<1.0.99"
serde_json = "1"
serde_test = "1"
secp256k1 = { version = "0.12", features = [ "rand" ] }

View File

@ -38,3 +38,12 @@ if [ "$DO_BENCH" = true ]
then
cargo bench --features unstable
fi
# Use as dependency if told to
if [ -n "$AS_DEPENDENCY" ]
then
cargo new dep_test
cd dep_test
echo 'bitcoin = { path = "..", features = ["use-serde"] }' >> Cargo.toml
cargo test --verbose
fi

View File

@ -696,7 +696,7 @@ impl<'de> serde::Deserialize<'de> for Script {
where
D: serde::Deserializer<'de>,
{
use std::fmt::{self, Formatter};
use std::fmt::Formatter;
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {

View File

@ -40,6 +40,8 @@
#![deny(non_camel_case_types)]
#![deny(non_snake_case)]
#![deny(unused_mut)]
#![deny(dead_code)]
#![deny(unused_imports)]
#![deny(missing_docs)]
#![forbid(unsafe_code)]

View File

@ -956,7 +956,7 @@ pub mod serde {
//! Serialize and deserialize [Amount] as real numbers denominated in satoshi.
//! Use with `#[serde(with = "amount::serde::as_sat")]`.
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde::{Deserializer, Serializer};
use util::amount::serde::SerdeAmount;
pub fn serialize<A: SerdeAmount, S: Serializer>(a: &A, s: S) -> Result<S::Ok, S::Error> {
@ -971,7 +971,7 @@ pub mod serde {
//! Serialize and deserialize [Optoin<Amount>] as real numbers denominated in satoshi.
//! Use with `#[serde(default, with = "amount::serde::as_sat::opt")]`.
use serde::{Deserialize, Deserializer, Serializer};
use serde::{Deserializer, Serializer};
use util::amount::serde::SerdeAmount;
pub fn serialize<A: SerdeAmount, S: Serializer>(
@ -996,7 +996,7 @@ pub mod serde {
//! Serialize and deserialize [Amount] as JSON numbers denominated in BTC.
//! Use with `#[serde(with = "amount::serde::as_btc")]`.
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde::{Deserializer, Serializer};
use util::amount::serde::SerdeAmount;
pub fn serialize<A: SerdeAmount, S: Serializer>(a: &A, s: S) -> Result<S::Ok, S::Error> {
@ -1011,7 +1011,7 @@ pub mod serde {
//! Serialize and deserialize [Option<Amount>] as JSON numbers denominated in BTC.
//! Use with `#[serde(default, with = "amount::serde::as_btc::opt")]`.
use serde::{Deserialize, Deserializer, Serializer};
use serde::{Deserializer, Serializer};
use util::amount::serde::SerdeAmount;
pub fn serialize<A: SerdeAmount, S: Serializer>(
@ -1247,7 +1247,6 @@ mod tests {
#[cfg(feature = "serde")]
#[test]
fn serde_as_sat() {
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct T {
@ -1279,7 +1278,6 @@ mod tests {
#[cfg(feature = "serde")]
#[test]
fn serde_as_btc() {
use serde::{Deserialize, Serialize};
use serde_json;
#[derive(Serialize, Deserialize, PartialEq, Debug)]
@ -1314,7 +1312,6 @@ mod tests {
#[cfg(feature = "serde")]
#[test]
fn serde_as_btc_opt() {
use serde::{Deserialize, Serialize};
use serde_json;
#[derive(Serialize, Deserialize, PartialEq, Debug)]