Skip to content

Commit e4c6a4e

Browse files
authored
Fix constructor.
1 parent b0a8543 commit e4c6a4e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

library/core/src/escape.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ impl<const N: usize, ESCAPING> EscapeIterInner<N, ESCAPING> {
193193
///
194194
/// `data.escape_seq` must contain an escape sequence in the range given by `alive`.
195195
#[inline]
196-
unsafe const fn new(data: MaybeEscapedCharacter<N>, alive: Range<u8>) -> Self {
196+
const unsafe fn new(data: MaybeEscapedCharacter<N>, alive: Range<u8>) -> Self {
197197
// Uphold the `alive` invariant for non-printable characters.
198198
const { assert!(N <= 127) };
199199
Self { data, alive, escaping: PhantomData }
@@ -286,11 +286,12 @@ impl<const N: usize> EscapeIterInner<N, MaybeEscaped> {
286286
// This is the only way to create an `EscapeIterInner` with a literal `char`, which
287287
// means the `AlwaysEscaped` marker guarantees that `self` contains an escape sequence.
288288
pub(crate) const fn printable(c: char) -> Self {
289-
Self::new(
290-
MaybeEscapedCharacter { literal: c },
289+
Self {
290+
data: MaybeEscapedCharacter { literal: c },
291291
// Ensure `len` behaves correctly.
292-
Self::CHAR_FLAG..(Self::CHAR_FLAG + 1),
293-
)
292+
alive: Self::CHAR_FLAG..(Self::CHAR_FLAG + 1),
293+
escaping: PhantomData,
294+
}
294295
}
295296

296297
#[inline]

0 commit comments

Comments
 (0)