Skip to content

Commit

Permalink
Adding formatting checks to Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jun 5, 2020
1 parent ed4f498 commit 23f046d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
18 changes: 10 additions & 8 deletions contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,19 @@ then
alias cargo="cargo +$TOOLCHAIN"
fi

# Test without any features first
# TODO: This is not working b/c of bitcoin_hashes macro problem.
# Uncomment once the problem will be fixed
# cargo test --verbose --all-features
# Check that we can build w/o features
cargo check --verbose --all-targets
cargo check --verbose --no-default-features --all-targets

# Test using all features
cargo test --verbose --all-features --all-targets

# Test each feature
# Check that we can build with each feature
for feature in ${FEATURES}
do
cargo check --verbose --features="$feature" --all-targets
done

# Test all features
cargo test --verbose --all-features --all-targets

# Fuzz if told to
if [ "$DO_FUZZ" = true ]
then
Expand All @@ -54,3 +53,6 @@ then
cd ..
rm -rf dep_test
fi

# Check formatting
cargo fmt --all -- --check
6 changes: 2 additions & 4 deletions src/bp/seals/tx_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
// along with this software.
// If not, see <https://opensource.org/licenses/MIT>.


use bitcoin::{Txid, Transaction, OutPoint};

use bitcoin::{OutPoint, Transaction, Txid};

pub enum SpendingStatus {
Unknown,
Invalid,
Unspent,
Spent(Option<u32>)
Spent(Option<u32>),
}

pub trait TxGraph {
Expand Down
8 changes: 4 additions & 4 deletions src/common/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ macro_rules! impl_try_from_stringly_standard {
use std::rc::Rc;
use std::sync::Arc;

impl_try_from_stringly!{ $type,
impl_try_from_stringly! { $type,
&str,
String,
Box<str>,
Expand All @@ -57,9 +57,9 @@ macro_rules! impl_try_from_stringly_standard {

}

#[cfg(feature="serde")]
#[cfg(feature = "serde")]
impl_try_from_stringly!($type, crate::common::serde::CowHelper<'_>);
}
};
}

/// Impls From<T> for Stringly where String: Into<Stringly>, T: Display
Expand Down Expand Up @@ -87,5 +87,5 @@ macro_rules! impl_into_stringly_standard {
Arc<str>,
Arc<String>,
}
}
};
}
2 changes: 1 addition & 1 deletion src/rpc/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ use bitcoin::consensus::encode::{

use super::{Error, Multipart};
use crate::bp::ShortId;
use crate::strategy::Holder;
#[cfg(feature = "use-rgb")]
use crate::csv::{self, network_deserialize, network_serialize};
use crate::strategy::Holder;

// 1. Encoding messages
pub trait MessageEncode
Expand Down
12 changes: 6 additions & 6 deletions src/rpc/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@
// along with this software.
// If not, see <https://opensource.org/licenses/MIT>.


use zmq;

use bitcoin;
use bitcoin::secp256k1;

#[cfg(feature="use-rgb")]
#[cfg(feature = "use-rgb")]
use crate::csv;


#[derive(Debug, Display, From)]
#[display_from(Debug)]
pub enum Error {
Expand All @@ -40,13 +38,15 @@ pub enum Error {

// General API errors that may happen with both requests and replies
MalformedArgument,
WrongNumberOfArguments
WrongNumberOfArguments,
}

impl std::error::Error for Error {}

impl From<Error> for String {
fn from(err: Error) -> Self { format!("{}", err) }
fn from(err: Error) -> Self {
format!("{}", err)
}
}

impl From<bitcoin::consensus::encode::Error> for Error {
Expand All @@ -55,7 +55,7 @@ impl From<bitcoin::consensus::encode::Error> for Error {
}
}

#[cfg(feature="use-rgb")]
#[cfg(feature = "use-rgb")]
impl From<csv::serialize::Error> for Error {
fn from(_: csv::serialize::Error) -> Self {
Error::MalformedArgument
Expand Down
8 changes: 4 additions & 4 deletions src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
// along with this software.
// If not, see <https://opensource.org/licenses/MIT>.

mod error;
mod encode;
mod error;

pub use error::*;
pub use encode::*;

pub use error::*;

pub type Multipart = Vec<zmq::Message>;
pub type CommandId = u16;

pub fn split_cmd_args(multipart: &Multipart) -> Result<(CommandId, &[zmq::Message]), Error> {
Ok(multipart.split_first()
Ok(multipart
.split_first()
.ok_or(Error::MalformedRequest)
.and_then(|(cmd_data, args)| {
if cmd_data.len() != 2 {
Expand Down

0 comments on commit 23f046d

Please sign in to comment.