Ignore protobuf schema when rustfmt is invoked

This commit is contained in:
Ding Xiang Fei
2018-05-24 13:32:29 +08:00
committed by Romain Ruetschi
parent f737c89da5
commit 7a1add13a1
5 changed files with 28 additions and 21 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
Cargo.lock Cargo.lock
target/ target/
src/proto/proof.rs

View File

@ -18,6 +18,7 @@ categories = ["data-structures", "cryptography"]
[dependencies] [dependencies]
cfg-if = "0.1.3"
ring = "^0.12.0" ring = "^0.12.0"
protobuf = { version = "1.7.1", optional = true } protobuf = { version = "1.7.1", optional = true }
serde = { version = "^1.0.55", optional = true } serde = { version = "^1.0.55", optional = true }

View File

@ -1,21 +1,28 @@
#![deny( #![deny(missing_docs, unused_qualifications, missing_debug_implementations,
missing_docs, unused_qualifications, missing_debug_implementations, missing_copy_implementations, trivial_casts, trivial_numeric_casts, unsafe_code,
missing_copy_implementations, trivial_casts, trivial_numeric_casts, unsafe_code, unstable_features, unused_import_braces)]
unstable_features, unused_import_braces
)]
//! *merkle* implements a Merkle Tree in Rust. //! *merkle* implements a Merkle Tree in Rust.
#[macro_use]
extern crate cfg_if;
extern crate ring; extern crate ring;
#[cfg(feature = "serialization-protobuf")] cfg_if! {
extern crate protobuf; if #[cfg(feature = "serialization-protobuf")] {
extern crate protobuf;
#[allow(unused_qualifications)]
mod proto;
}
}
#[cfg(feature = "serialization-serde")] cfg_if! {
extern crate serde; if #[cfg(feature = "serialization-serde")] {
#[cfg(feature = "serialization-serde")] extern crate serde;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
}
}
mod merkletree; mod merkletree;
pub use merkletree::MerkleTree; pub use merkletree::MerkleTree;
@ -29,9 +36,5 @@ pub use hashutils::Hashable;
mod tree; mod tree;
pub use tree::{LeavesIntoIterator, LeavesIterator}; pub use tree::{LeavesIntoIterator, LeavesIterator};
#[cfg(feature = "serialization-protobuf")]
#[allow(unused_qualifications)]
mod proto;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;

View File

@ -52,10 +52,8 @@ mod algorithm_serde {
mod test { mod test {
use super::*; use super::*;
use ring::digest::{ use ring::digest::{SHA1 as sha1, SHA256 as sha256, SHA384 as sha384, SHA512 as sha512,
SHA1 as sha1, SHA256 as sha256, SHA384 as sha384, SHA512 as sha512, SHA512_256 as sha512_256};
SHA512_256 as sha512_256,
};
static SHA1: &Algorithm = &sha1; static SHA1: &Algorithm = &sha1;
static SHA256: &Algorithm = &sha256; static SHA256: &Algorithm = &sha256;

View File

@ -1,4 +1,8 @@
mod proof; cfg_if! {
if #[cfg(not(rustfmt))] {
mod proof;
}
}
use ring::digest::Algorithm; use ring::digest::Algorithm;