Skip to content

Commit 12d1420

Browse files
committed
make some fns const
1 parent bdf642b commit 12d1420

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

portable/src/compat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl Utf8Error {
3232
/// ...
3333
#[inline]
3434
#[must_use]
35-
pub fn valid_up_to(&self) -> usize {
35+
pub const fn valid_up_to(&self) -> usize {
3636
self.valid_up_to
3737
}
3838

portable/src/implementation/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ fn validate_utf8_compat_simd(input: &[u8]) -> Result<(), crate::compat::Utf8Erro
3333

3434
// fallback method implementations
3535
#[inline]
36-
pub(crate) fn validate_utf8_basic_fallback(input: &[u8]) -> Result<(), crate::basic::Utf8Error> {
36+
pub(crate) const fn validate_utf8_basic_fallback(
37+
input: &[u8],
38+
) -> Result<(), crate::basic::Utf8Error> {
3739
match core::str::from_utf8(input) {
3840
Ok(_) => Ok(()),
3941
Err(_) => Err(crate::basic::Utf8Error {}),

portable/src/implementation/simd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ impl SimdU8Value<32> for u8x32 {
471471

472472
#[inline]
473473
fn prev1(self, prev: Self) -> Self {
474+
// FIXME? this is more than we actually need. Not sure if AVX2 support this
474475
simd_swizzle!(
475476
self,
476477
prev,

portable/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
clippy::nursery
88
)]
99
#![expect(clippy::redundant_pub_crate)] // check is broken (see e.g. https://github.com/rust-lang/rust-clippy/issues/5369)
10-
#![expect(clippy::missing_const_for_fn)] // not necessary most of the times
1110
#![deny(missing_docs)]
1211
#![cfg_attr(not(feature = "std"), no_std)]
1312
#![cfg_attr(docsrs, feature(doc_cfg))]

0 commit comments

Comments
 (0)