From fdb1f1694f44cfbc59d303a10371300b48d74627 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 7 Jul 2022 18:49:00 +0200 Subject: Refactor to use `char::REPLACEMENT_CHARACTER` --- readme.md | 2 +- src/util/codes.rs | 2 +- src/util/decode_character_reference.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index be584f6..0634eec 100644 --- a/readme.md +++ b/readme.md @@ -145,7 +145,6 @@ cargo doc --document-private-items #### Misc -- [ ] (1) use `char::REPLACEMENT_CHARACTER`? - [ ] (3) `nostd` - [ ] (3) Check subtokenizer unraveling is ok - [ ] (3) Remove splicing and cloning in subtokenizer @@ -275,3 +274,4 @@ important. - [x] (2) Fix resizing attention bug - [x] (2) Fix interleaving of attention/label - [x] (8) Add basic support for block quotes +- [x] (1) use `char::REPLACEMENT_CHARACTER`? diff --git a/src/util/codes.rs b/src/util/codes.rs index 8a46d02..9b6ad39 100644 --- a/src/util/codes.rs +++ b/src/util/codes.rs @@ -35,7 +35,7 @@ pub fn parse(value: &str) -> Vec { // Send a replacement character. '\0' => { column += 1; - codes.push(Code::Char('�')); + codes.push(Code::Char(char::REPLACEMENT_CHARACTER)); } // Send a tab and virtual spaces. '\t' => { diff --git a/src/util/decode_character_reference.rs b/src/util/decode_character_reference.rs index 9be531b..874df4d 100644 --- a/src/util/decode_character_reference.rs +++ b/src/util/decode_character_reference.rs @@ -96,7 +96,7 @@ pub fn decode_numeric(value: &str, radix: u32) -> char { // Out of range code > 0x0010_ffff { - '�' + char::REPLACEMENT_CHARACTER } else { char::from_u32(code).expect("expected valid `code`") } -- cgit