Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump MSRV to 1.60.0, use dtolnay/rust-toolchain #422

Merged
merged 4 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 9 additions & 27 deletions .github/workflows/ci-full-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install Rust toolchain
id: install-rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
uses: dtolnay/rust-toolchain@stable

# Cache based on OS/compiler.
- name: Extract cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.cargo
Expand All @@ -30,34 +27,19 @@ jobs:
target
!target/tests
!target/examples
key: ${{ runner.os }}-${{ steps.install-rust.outputs.rustc_hash }}
key: ${{ runner.os }}-${{ steps.install-rust.outputs.cachekey }}

- name: Test all crates
uses: actions-rs/cargo@v1
with:
command: test
args: --all --verbose --features "use_serde"
run: cargo test --all --verbose --features "use_serde"

- name: Test si
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --no-default-features --features "f32 si"
run: cargo test --verbose --no-default-features --features "f32 si"

- name: Test all non-storage type features
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --no-default-features --features "autoconvert f32 si use_serde"
run: cargo test --verbose --no-default-features --features "autoconvert f32 si use_serde"

- name: Test si with underlying storage types
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --no-run --no-default-features --features "autoconvert usize isize bigint bigrational complex32 si std use_serde"
run: cargo test --verbose --no-run --no-default-features --features "autoconvert usize isize bigint bigrational complex32 si std use_serde"

- name: Test all non-si features
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --no-run --no-default-features --features "autoconvert usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 bigint biguint rational rational32 rational64 bigrational complex32 complex64 f32 f64 std use_serde"
run: cargo test --verbose --no-run --no-default-features --features "autoconvert usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 bigint biguint rational rational32 rational64 bigrational complex32 complex64 f32 f64 std use_serde"
31 changes: 6 additions & 25 deletions .github/workflows/ci-min-test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ jobs:
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: -D warnings
CARGO_NET_GIT_FETCH_WITH_CLI: ${{ matrix.cli_fetch }}

strategy:
fail-fast: false # If one job fails, run remaining jobs.
Expand All @@ -16,38 +15,20 @@ jobs:
- ubuntu-latest
- macOS-latest
- windows-latest
rust:
toolchain:
- stable
- beta
- nightly
- 1.43.0 # MSRV
exclude:
- os: ubuntu-latest
rust: stable
- os: macOS-latest
rust: 1.43.0
include: # https://github.com/rust-lang/cargo/issues/10303
- cli_fetch: false
- os: ubuntu-latest
rust: 1.43.0
cli_fetch: true
- 1.60.0 # MSRV

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install Rust toolchain
id: install-rust
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{ matrix.rust }}
override: true

# Skip cache, workflow runs in ~5 minutes.
toolchain: ${{ matrix.toolchain }}

- name: Test all crates
uses: actions-rs/cargo@v1
with:
command: test
args: --all --verbose --features "use_serde"
run: cargo test --all --verbose --features "use_serde"
42 changes: 21 additions & 21 deletions .github/workflows/ci-tool-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,24 @@ jobs:
strategy:
matrix:
toolchain:
- 1.62.1
- 1.70.0

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install Rust nightly toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
components: rustfmt, clippy

# Tools-specific cache based on OS/compiler.
- name: Extract tools cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.cargo
Expand All @@ -34,34 +35,33 @@ jobs:
target
!target/tests
!target/examples
key: tools-${{ runner.os }}-${{ steps.install-rust.outputs.rustc_hash }}
key: tools-${{ runner.os }}-${{ steps.install-rust.outputs.cachekey }}

- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --tests -- -D warnings
run: cargo clippy --all --tests -- -D warnings

- name: Rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all -- --check

- name: Rustdoc
uses: actions-rs/cargo@v1
with:
command: doc
args: --all --no-deps
run: cargo doc --all --no-deps
env:
RUSTDOCFLAGS: '-D warnings'

- name: Install cargo-binstall
if: ${{ success() && github.event_name == 'push' }}
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash

- name: Install tarpaulin
if: ${{ success() && github.event_name == 'push' }}
run: cargo binstall --no-confirm cargo-tarpaulin

- name: Run tarpaulin
uses: actions-rs/[email protected]
if: ${{ success() && github.event_name == 'push' }}
run: cargo +nightly tarpaulin --verbose --timeout 120 --out Xml

- name: Upload to codecov.io
uses: codecov/[email protected]
if: ${{ success() && github.event_name == 'push' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ autobenches = true
features = ["usize", "u32", "u64", "isize", "i32", "i64", "bigint", "biguint", "rational", "rational32", "rational64", "bigrational", "use_serde"]

[package.metadata]
msrv = "1.43.0"
msrv = "1.60.0"

[badges]
maintenance = { status = "actively-developed" }
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
uom
===
[![Github Actions](https://img.shields.io/github/workflow/status/iliekturtles/uom/CI%20-%20full%20test%20suite/master?label=build)](https://github.com)
[![Github Actions](https://img.shields.io/github/actions/workflow/status/iliekturtles/uom/ci-full-test-suite.yml?branch=master)](https://github.com/iliekturtles/uom/actions)
[![Codecov.io](https://img.shields.io/codecov/c/github/iliekturtles/uom/master)](https://codecov.io/gh/iliekturtles/uom)
[![Rustup.rs](https://img.shields.io/badge/rustc-1.43.0%2B-orange.svg)](https://rustup.rs/)
[![Rustup.rs](https://img.shields.io/badge/rustc-1.60.0%2B-orange.svg)](https://rustup.rs/)
[![Crates.io](https://img.shields.io/crates/v/uom.svg)](https://crates.io/crates/uom)
[![Crates.io](https://img.shields.io/crates/l/uom.svg)](https://crates.io/crates/uom)
[![Documentation](https://img.shields.io/badge/documentation-docs.rs-blue.svg)](https://docs.rs/uom)
Expand All @@ -23,7 +23,7 @@ Units of measurement is a crate that does automatic type-safe zero-cost
[orbiter]: https://en.wikipedia.org/wiki/Mars_Climate_Orbiter

## Usage
`uom` requires `rustc` 1.43.0 or later. Add this to your `Cargo.toml`:
`uom` requires `rustc` 1.60.0 or later. Add this to your `Cargo.toml`:

```toml
[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! [orbiter]: https://en.wikipedia.org/wiki/Mars_Climate_Orbiter
//!
//! ## Usage
//! `uom` requires `rustc` 1.43.0 or later. Add this to your `Cargo.toml`:
//! `uom` requires `rustc` 1.60.0 or later. Add this to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
Expand Down
51 changes: 25 additions & 26 deletions src/si/thermal_conductance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,36 +198,35 @@ mod tests {
}

#[test]
fn check_power_per_length_ti_units() {
test::<p::yottawatt, l::meter, ti::kelvin, tc::yottawatt_per_kelvin>();
test::<p::zettawatt, l::meter, ti::kelvin, tc::zettawatt_per_kelvin>();
test::<p::exawatt, l::meter, ti::kelvin, tc::exawatt_per_kelvin>();
test::<p::petawatt, l::meter, ti::kelvin, tc::petawatt_per_kelvin>();
test::<p::terawatt, l::meter, ti::kelvin, tc::terawatt_per_kelvin>();
test::<p::gigawatt, l::meter, ti::kelvin, tc::gigawatt_per_kelvin>();
test::<p::megawatt, l::meter, ti::kelvin, tc::megawatt_per_kelvin>();
test::<p::kilowatt, l::meter, ti::kelvin, tc::kilowatt_per_kelvin>();
test::<p::hectowatt, l::meter, ti::kelvin, tc::hectowatt_per_kelvin>();
test::<p::decawatt, l::meter, ti::kelvin, tc::decawatt_per_kelvin>();
test::<p::watt, l::meter, ti::kelvin, tc::watt_per_kelvin>();
test::<p::deciwatt, l::meter, ti::kelvin, tc::deciwatt_per_kelvin>();
test::<p::centiwatt, l::meter, ti::kelvin, tc::centiwatt_per_kelvin>();
test::<p::milliwatt, l::meter, ti::kelvin, tc::milliwatt_per_kelvin>();
test::<p::microwatt, l::meter, ti::kelvin, tc::microwatt_per_kelvin>();
test::<p::nanowatt, l::meter, ti::kelvin, tc::nanowatt_per_kelvin>();
test::<p::picowatt, l::meter, ti::kelvin, tc::picowatt_per_kelvin>();
test::<p::femtowatt, l::meter, ti::kelvin, tc::femtowatt_per_kelvin>();
test::<p::attowatt, l::meter, ti::kelvin, tc::attowatt_per_kelvin>();
test::<p::zeptowatt, l::meter, ti::kelvin, tc::zeptowatt_per_kelvin>();
test::<p::yoctowatt, l::meter, ti::kelvin, tc::yoctowatt_per_kelvin>();
fn check_power_ti_units() {
test::<p::yottawatt, ti::kelvin, tc::yottawatt_per_kelvin>();
test::<p::zettawatt, ti::kelvin, tc::zettawatt_per_kelvin>();
test::<p::exawatt, ti::kelvin, tc::exawatt_per_kelvin>();
test::<p::petawatt, ti::kelvin, tc::petawatt_per_kelvin>();
test::<p::terawatt, ti::kelvin, tc::terawatt_per_kelvin>();
test::<p::gigawatt, ti::kelvin, tc::gigawatt_per_kelvin>();
test::<p::megawatt, ti::kelvin, tc::megawatt_per_kelvin>();
test::<p::kilowatt, ti::kelvin, tc::kilowatt_per_kelvin>();
test::<p::hectowatt, ti::kelvin, tc::hectowatt_per_kelvin>();
test::<p::decawatt, ti::kelvin, tc::decawatt_per_kelvin>();
test::<p::watt, ti::kelvin, tc::watt_per_kelvin>();
test::<p::deciwatt, ti::kelvin, tc::deciwatt_per_kelvin>();
test::<p::centiwatt, ti::kelvin, tc::centiwatt_per_kelvin>();
test::<p::milliwatt, ti::kelvin, tc::milliwatt_per_kelvin>();
test::<p::microwatt, ti::kelvin, tc::microwatt_per_kelvin>();
test::<p::nanowatt, ti::kelvin, tc::nanowatt_per_kelvin>();
test::<p::picowatt, ti::kelvin, tc::picowatt_per_kelvin>();
test::<p::femtowatt, ti::kelvin, tc::femtowatt_per_kelvin>();
test::<p::attowatt, ti::kelvin, tc::attowatt_per_kelvin>();
test::<p::zeptowatt, ti::kelvin, tc::zeptowatt_per_kelvin>();
test::<p::yoctowatt, ti::kelvin, tc::yoctowatt_per_kelvin>();

test::<p::kilowatt, l::meter, ti::degree_celsius, tc::kilowatt_per_degree_celsius>();
test::<p::watt, l::meter, ti::degree_celsius, tc::watt_per_meter_degree_celsius>();
test::<p::milliwatt, l::meter, ti::degree_celsius, tc::milliwatt_per_degree_celsius>();
test::<p::kilowatt, ti::degree_celsius, tc::kilowatt_per_degree_celsius>();
test::<p::watt, ti::degree_celsius, tc::watt_per_meter_degree_celsius>();
test::<p::milliwatt, ti::degree_celsius, tc::milliwatt_per_degree_celsius>();

fn test<
P: p::Conversion<V>,
L: l::Conversion<V>,
TI: ti::Conversion<V>,
TC: tc::Conversion<V>>()
{
Expand Down
4 changes: 2 additions & 2 deletions src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ macro_rules! system {
U: Units<V> + ?Sized,
V: $crate::num::Num + $crate::Conversion<V> + $crate::lib::fmt::Debug,
{
fn fmt<'a>(&self, f: &mut $crate::lib::fmt::Formatter<'a>) -> $crate::lib::fmt::Result {
fn fmt(&self, f: &mut $crate::lib::fmt::Formatter) -> $crate::lib::fmt::Result {
self.value.fmt(f)
$(.and_then(|_| {
let d = <D::$symbol as $crate::typenum::Integer>::to_i32();
Expand Down Expand Up @@ -1514,7 +1514,7 @@ macro_rules! system {
V: Num + Conversion<V> + fmt::$style,
N: Unit + Conversion<V, T = V::T>,
{
fn fmt<'a>(&self, f: &mut fmt::Formatter<'a>) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let value = from_base::<D, U, V, N>(&self.quantity.value);

value.fmt(f)?;
Expand Down
2 changes: 1 addition & 1 deletion uom-macros/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ uom-macros
===
[![Travis](https://travis-ci.org/iliekturtles/uom.svg?branch=master)](https://travis-ci.org/iliekturtles/uom)
[![Coveralls](https://coveralls.io/repos/github/iliekturtles/uom/badge.svg?branch=master)](https://coveralls.io/github/iliekturtles/uom?branch=master)
[![Rustup.rs](https://img.shields.io/badge/rustc-1.43.0%2B-orange.svg)](https://rustup.rs/)
[![Rustup.rs](https://img.shields.io/badge/rustc-1.60.0%2B-orange.svg)](https://rustup.rs/)
[![Crates.io](https://img.shields.io/crates/v/uom-macros.svg)](https://crates.io/crates/uom-macros)
[![Crates.io](https://img.shields.io/crates/l/uom-macros.svg)](https://crates.io/crates/uom-macros)
[![Documentation](https://img.shields.io/badge/documentation-docs.rs-blue.svg)](https://docs.rs/uom-macros)
Expand Down