Skip to content

Commit

Permalink
allow unexpected-cfgs lints
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Oct 18, 2024
1 parent 8dc84ec commit 2800e1b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@ version_check = "0.9"

[features]
nightly = []

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(__unicase__core_and_alloc)',
'cfg(__unicase__const_fns)',
'cfg(__unicase__default_hasher)',
'cfg(__unicase__iter_cmp)',
] }
10 changes: 8 additions & 2 deletions src/ascii.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ use std::ascii::AsciiExt;
use super::{Ascii, Encoding, UniCase};

impl<S> Ascii<S> {
/// Construct a new `Ascii`.
///
/// For Rust versions >= 1.31, this is a `const fn`.
#[inline]
#[cfg(__unicase__const_fns)]
pub const fn new(s: S) -> Ascii<S> {
Expand All @@ -27,16 +30,19 @@ impl<S> Ascii<S> {
Ascii(s)
}

#[cfg(__unicase_const_fns)]
/// Convert this into a [`UniCase`].
#[cfg(__unicase__const_fns)]
pub const fn into_unicase(self) -> UniCase<S> {
UniCase(Encoding::Ascii(self))
}

#[cfg(not(__unicase_const_fns))]
/// Convert this into a [`UniCase`].
#[cfg(not(__unicase__const_fns))]
pub fn into_unicase(self) -> UniCase<S> {
UniCase(Encoding::Ascii(self))
}

/// Consume this `Ascii` and get the inner value.
#[inline]
pub fn into_inner(self) -> S {
self.0
Expand Down

0 comments on commit 2800e1b

Please sign in to comment.