From f8de575fd723e9070cf98ea5082c5691ca450640 Mon Sep 17 00:00:00 2001 From: David Hadley Date: Sat, 16 Oct 2021 14:05:42 +0100 Subject: [PATCH] Release 0.6.2 - Fix for compiler/clippy warnings when building with the latest stable version (clippy 0.1.55, rustc 1.55.0). - Include pre-commit hooks in continuous integration. --- .github/workflows/ci.yml | 6 +++ .pre-commit-config.yaml | 12 +++--- LICENSE | 1 + ndhistogram/CHANGELOG.md | 6 +++ ndhistogram/Cargo.toml | 38 +++++++++---------- ndhistogram/README.md | 2 +- ndhistogram/src/histogram/vechistogram.rs | 3 +- ndhistogram/src/lib.rs | 10 ++--- ndhistogram/tests/test_category_axis.rs | 2 +- ndhistogram/tests/test_categorynoflow_axis.rs | 2 +- 10 files changed, 47 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4269e36..94541e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,4 +60,10 @@ jobs: args: -- -D warnings - name: cargo doc run: RUSTDOCFLAGS="-D warnings" cargo doc + - name: Setup python + uses: actions/setup-python@v2 + - name: Run pre-commit hooks + run: | + pip install pre-commit \ + && pre-commit run --all diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 806d079..bdb654d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,13 +11,13 @@ repos: types: [rust] - repo: https://github.com/timothycrosley/isort - rev: 5.5.3 + rev: 5.9.3 hooks: - id: isort stages: [commit] - repo: https://github.com/ambv/black - rev: stable + rev: 21.9b0 hooks: - id: black language_version: python3 @@ -25,18 +25,18 @@ repos: - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.2 + rev: 3.9.2 hooks: - id: flake8 stages: [commit] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.782 + rev: v0.910-1 hooks: - id: mypy - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v1.6.1 + rev: v2.2.0 hooks: - id: pretty-format-yaml args: [--autofix] @@ -44,7 +44,7 @@ repos: args: [--autofix] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v4.0.1 hooks: - id: check-added-large-files - id: check-ast diff --git a/LICENSE b/LICENSE index e69de29..3fb95ef 100644 --- a/LICENSE +++ b/LICENSE @@ -0,0 +1 @@ +Apache-2.0 OR MIT diff --git a/ndhistogram/CHANGELOG.md b/ndhistogram/CHANGELOG.md index a3b23ab..e6147d0 100644 --- a/ndhistogram/CHANGELOG.md +++ b/ndhistogram/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.6.2 (2021-10-16) + +- Fix for compiler/clippy warnings when building with the latest stable version (clippy 0.1.55, rustc 1.55.0). +- Include pre-commit hooks in continuous integration. + + # 0.6.1 (2021-06-27) - Fix for compiler/clippy warnings when building with the latest stable version (clippy 0.1.53, rustc 1.53.0). diff --git a/ndhistogram/Cargo.toml b/ndhistogram/Cargo.toml index 14481e1..e2dcfc7 100644 --- a/ndhistogram/Cargo.toml +++ b/ndhistogram/Cargo.toml @@ -2,24 +2,13 @@ name = "bench_fill" harness = false -[lib] -bench = false - -[package] -name = "ndhistogram" -version = "0.6.1" -authors = [ "David Hadley ",] -edition = "2018" -license = "MIT OR Apache-2.0" -description = "multi-dimensional histogramming for Rust" -repository = "https://github.com/davehadley/rust-hist" -readme = "README.md" -keywords = [ "histogram", "statistics", "data", "analysis", "multidimensional",] -categories = [ "science", "mathematics", "data-structures",] - [dependencies] num-traits = "0.2.14" +[dependencies.serde] +version = "1.0.120" +features = [ "derive",] + [dev-dependencies] rand = "0.8.0" rand_distr = "0.4.0" @@ -27,10 +16,21 @@ serde_json = "1.0.61" version-sync = "0.9.1" paste = "1.0.4" -[dependencies.serde] -version = "1.0.120" -features = [ "derive",] - [dev-dependencies.criterion] version = "0.3.4" features = [ "html_reports",] + +[lib] +bench = false + +[package] +name = "ndhistogram" +version = "0.6.2" +authors = [ "David Hadley ",] +edition = "2018" +license = "MIT OR Apache-2.0" +description = "multi-dimensional histogramming for Rust" +repository = "https://github.com/davehadley/rust-hist" +readme = "README.md" +keywords = [ "histogram", "statistics", "data", "analysis", "multidimensional",] +categories = [ "science", "mathematics", "data-structures",] diff --git a/ndhistogram/README.md b/ndhistogram/README.md index e4c9d3d..122c355 100644 --- a/ndhistogram/README.md +++ b/ndhistogram/README.md @@ -30,7 +30,7 @@ Add this to your `Cargo.toml`: ```toml [dependencies] -ndhistogram = "0.6.1" +ndhistogram = "0.6.2" ``` See the [change log](https://github.com/davehadley/ndhistogram/blob/main/ndhistogram/CHANGELOG.md) diff --git a/ndhistogram/src/histogram/vechistogram.rs b/ndhistogram/src/histogram/vechistogram.rs index e027078..6cbc8c2 100644 --- a/ndhistogram/src/histogram/vechistogram.rs +++ b/ndhistogram/src/histogram/vechistogram.rs @@ -2,7 +2,6 @@ use std::{ cmp::Ordering, f64::INFINITY, fmt::Display, - iter::repeat, ops::{Add, Div, Mul, Sub}, }; @@ -145,7 +144,7 @@ where .map(|(bin, value)| { ( format!("{:.precision$}", bin, precision = precision), - repeat("#").take(value as usize).collect::(), + "#".repeat(value as usize), ) }) .map(|(bin, value)| write!(f, "\n{:>16} | {}", bin, value)) diff --git a/ndhistogram/src/lib.rs b/ndhistogram/src/lib.rs index e1d9816..a984874 100644 --- a/ndhistogram/src/lib.rs +++ b/ndhistogram/src/lib.rs @@ -19,7 +19,7 @@ //! //! ```toml //! [dependencies] -//! ndhistogram = "0.6.1" +//! ndhistogram = "0.6.2" //! ``` //! //! See the [change log](https://github.com/davehadley/ndhistogram/blob/main/ndhistogram/CHANGELOG.md) @@ -128,7 +128,7 @@ //! User defined bin value types are possible by implementing the [Fill](Fill), [FillWith](FillWith) or [FillWithWeighted](FillWithWeighted) traits. #![doc(issue_tracker_base_url = "https://github.com/davehadley/rust-hist/issues")] -#![doc(html_root_url = "https://docs.rs/ndhistogram/0.6.1")] +#![doc(html_root_url = "https://docs.rs/ndhistogram/0.6.2")] #![cfg_attr( debug_assertions, warn( @@ -140,9 +140,9 @@ deny(unsafe_code, macro_use_extern_crate), warn( missing_docs, - missing_crate_level_docs, - missing_doc_code_examples, - broken_intra_doc_links, + rustdoc::missing_crate_level_docs, + rustdoc::missing_doc_code_examples, + rustdoc::broken_intra_doc_links, ) )] diff --git a/ndhistogram/tests/test_category_axis.rs b/ndhistogram/tests/test_category_axis.rs index cbe5739..0884af6 100644 --- a/ndhistogram/tests/test_category_axis.rs +++ b/ndhistogram/tests/test_category_axis.rs @@ -10,7 +10,7 @@ fn test_category_num_bins() { fn test_category_get_index() { let cats = vec!["A", "B"]; let ax = Category::new(cats.clone()); - let actual: Vec = cats.iter().map(|c| ax.index(&c).unwrap()).collect(); + let actual: Vec = cats.iter().map(|c| ax.index(c).unwrap()).collect(); let expected = vec![0, 1]; assert_eq!(expected, actual) } diff --git a/ndhistogram/tests/test_categorynoflow_axis.rs b/ndhistogram/tests/test_categorynoflow_axis.rs index 1a94b88..d9c54a8 100644 --- a/ndhistogram/tests/test_categorynoflow_axis.rs +++ b/ndhistogram/tests/test_categorynoflow_axis.rs @@ -10,7 +10,7 @@ fn test_categorynoflow_num_bins() { fn test_categorynoflow_get_index() { let cats = vec!["A", "B"]; let ax = CategoryNoFlow::new(cats.clone()); - let actual: Vec = cats.iter().map(|c| ax.index(&c).unwrap()).collect(); + let actual: Vec = cats.iter().map(|c| ax.index(c).unwrap()).collect(); let expected = vec![0, 1]; assert_eq!(expected, actual) }