Skip to content

Commit 7f4e47c

Browse files
committed
Constify AsciiStr.len() and AsciiStr.is_empty()
slice.len() became const fn in Rust 1.39.0.
1 parent 90abe2d commit 7f4e47c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ascii_str.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl AsciiStr {
139139
/// ```
140140
#[inline]
141141
#[must_use]
142-
pub fn len(&self) -> usize {
142+
pub const fn len(&self) -> usize {
143143
self.slice.len()
144144
}
145145

@@ -155,7 +155,7 @@ impl AsciiStr {
155155
/// ```
156156
#[inline]
157157
#[must_use]
158-
pub fn is_empty(&self) -> bool {
158+
pub const fn is_empty(&self) -> bool {
159159
self.len() == 0
160160
}
161161

0 commit comments

Comments
 (0)