From b9dae28cb62da3db95aa8e65f339c540bac08f7c Mon Sep 17 00:00:00 2001 From: Daniel Eades Date: Wed, 5 Apr 2023 21:46:23 +0100 Subject: [PATCH] add format check to CI --- .github/dependabot.yml | 8 ++++++++ .github/workflows/CI.yml | 19 +++++++++++++++++++ tree-buf-macros/src/lib.rs | 6 ++---- tree-buf/src/experimental/mod.rs | 2 +- tree-buf/src/experimental/options.rs | 13 +++---------- tree-buf/src/internal/mod.rs | 2 +- 6 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/CI.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0300aaf --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + ignore: + - dependency-name: dtolnay/rust-toolchain diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..304f0c7 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,19 @@ +on: + push: + branches: [master] + pull_request: + +name: Continuous integration + +jobs: + + fmt: + name: format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@nightly + with: + components: rustfmt + - run: cargo fmt --all --check + diff --git a/tree-buf-macros/src/lib.rs b/tree-buf-macros/src/lib.rs index 5b18bc7..d50a662 100644 --- a/tree-buf-macros/src/lib.rs +++ b/tree-buf-macros/src/lib.rs @@ -3,9 +3,9 @@ extern crate syn; #[macro_use] extern crate quote; -mod utils; mod decode; mod encode; +mod utils; use { decode::impl_decode_macro, @@ -13,8 +13,6 @@ use { syn::{parse_macro_input, DeriveInput}, }; - - #[proc_macro_derive(Encode)] pub fn encode_macro_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream { let ast = parse_macro_input!(input as DeriveInput); @@ -27,4 +25,4 @@ pub fn decode_macro_derive(input: proc_macro::TokenStream) -> proc_macro::TokenS let ast = parse_macro_input!(input as DeriveInput); let output = impl_decode_macro(&ast); proc_macro::TokenStream::from(output) -} \ No newline at end of file +} diff --git a/tree-buf/src/experimental/mod.rs b/tree-buf/src/experimental/mod.rs index 0a877ab..4e2b8ab 100644 --- a/tree-buf/src/experimental/mod.rs +++ b/tree-buf/src/experimental/mod.rs @@ -3,7 +3,7 @@ //! or resulting file may change unexpectedly with any version. Even so, it is worth //! poking around. +pub mod options; #[doc(hidden)] pub mod scratch; pub mod stats; -pub mod options; \ No newline at end of file diff --git a/tree-buf/src/experimental/options.rs b/tree-buf/src/experimental/options.rs index 892ce05..c381a99 100644 --- a/tree-buf/src/experimental/options.rs +++ b/tree-buf/src/experimental/options.rs @@ -5,16 +5,9 @@ use crate::prelude::*; -pub use crate::internal::options::{ - DisableParallel, - EnableParallel, - LosslessFloat, - LossyFloatTolerance, - EncodeOptions, DecodeOptions -}; - -pub use crate::{encode_options, decode_options}; +pub use crate::internal::options::{DecodeOptions, DisableParallel, EnableParallel, EncodeOptions, LosslessFloat, LossyFloatTolerance}; +pub use crate::{decode_options, encode_options}; #[cfg(feature = "encode")] pub fn encode_with_options(value: &T, options: &impl EncodeOptions) -> Vec { @@ -38,4 +31,4 @@ pub fn decode_with_options(bytes: &[u8], options: &impl DecodeOpti profile_fn!(T, decode_with_options); let sticks = decode_root(bytes)?; T::decode(sticks, options) -} \ No newline at end of file +} diff --git a/tree-buf/src/internal/mod.rs b/tree-buf/src/internal/mod.rs index ba1322f..54accf0 100644 --- a/tree-buf/src/internal/mod.rs +++ b/tree-buf/src/internal/mod.rs @@ -16,8 +16,8 @@ pub mod parallel; pub mod rust_std; pub mod types; -pub use {branch::*, encoder_decoder::*, encodings::*, options::*, parallel::*, rust_std::*, types::*}; pub(crate) use buffer::*; +pub use {branch::*, encoder_decoder::*, encodings::*, options::*, parallel::*, rust_std::*, types::*}; pub(crate) use markers::*;