Skip to content

Commit

Permalink
prefer required-features
Browse files Browse the repository at this point in the history
  • Loading branch information
jordens committed Sep 9, 2024
1 parent a3d073b commit 89008c0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ jobs:
- name: Enable nightly-only tests
run: echo RUSTFLAGS=${RUSTFLAGS}\ --cfg=thiserror_nightly_testing >> $GITHUB_ENV
if: matrix.rust == 'nightly'
- run: cargo test --all
- name: Enable no_std
- name: Test no-default-features
run: cargo test --all --no-default-features
if: matrix.rust != '1.56.0'
- run: cargo test --all
- uses: actions/upload-artifact@v4
if: matrix.rust == 'nightly' && always()
with:
Expand Down
19 changes: 17 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/dtolnay/thiserror"
rust-version = "1.56"

# without the `std` feature (i.e. `no_std`):
# rust-version = "1.81"
# without the `std` feature (i.e. `no_std`): rust-version = "1.81"

[dependencies]
thiserror-impl = { version = "=1.0.63", path = "impl" }
Expand All @@ -33,3 +32,19 @@ rustdoc-args = ["--generate-link-to-definition"]
[features]
std = []
default = ["std"]

[[test]]
name = "compiletest"
required-features = ["std"]

[[test]]
name = "test_lints"
required-features = ["std"]

[[test]]
name = "test_path"
required-features = ["std"]

[[test]]
name = "test_transparent"
required-features = ["std"]
2 changes: 0 additions & 2 deletions tests/compiletest.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#[allow(unused_attributes)]
#[rustversion::attr(not(nightly), ignore = "requires nightly")]
#[cfg_attr(not(feature = "std"), ignore = "requires std")]
#[cfg_attr(miri, ignore = "incompatible with miri")]
#[test]
fn ui() {
Expand Down
1 change: 0 additions & 1 deletion tests/test_lints.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![cfg(feature = "std")]
#![allow(clippy::mixed_attributes_style)]

use thiserror::Error;
Expand Down
2 changes: 0 additions & 2 deletions tests/test_path.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg(feature = "std")]

use core::fmt::Display;
use ref_cast::RefCast;
use std::path::{Path, PathBuf};
Expand Down
2 changes: 0 additions & 2 deletions tests/test_transparent.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg(feature = "std")]

use anyhow::anyhow;
use std::error::Error as _;
use std::io;
Expand Down

0 comments on commit 89008c0

Please sign in to comment.