aboutsummaryrefslogtreecommitdiffstats
path: root/src/tokenizer.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-09 10:54:13 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-09 10:54:13 +0200
commit13337d77954b4c92d1cf4592f43f01d94fce3c77 (patch)
treed5feef9a971c1af52e58b5c857d1dd9c9e7fedca /src/tokenizer.rs
parent71dbc8c0189d6b2032f3d8f21cbfffa3f8fe0f12 (diff)
downloadmarkdown-rs-13337d77954b4c92d1cf4592f43f01d94fce3c77.tar.gz
markdown-rs-13337d77954b4c92d1cf4592f43f01d94fce3c77.tar.bz2
markdown-rs-13337d77954b4c92d1cf4592f43f01d94fce3c77.zip
Refactor to move byte, char info to own file
Diffstat (limited to 'src/tokenizer.rs')
-rw-r--r--src/tokenizer.rs20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index 04523b3..aca8ec2 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -12,15 +12,8 @@ use crate::event::{Content, Event, Kind, Link, Name, Point, VOID_EVENTS};
use crate::parser::ParseState;
use crate::resolve::{call as call_resolve, Name as ResolveName};
use crate::state::{call, State};
-use crate::util::{constant::TAB_SIZE, edit_map::EditMap};
-use alloc::{
- boxed::Box,
- format,
- string::{String, ToString},
- vec,
- vec::Vec,
-};
-use core::str;
+use crate::util::{char::format_byte_opt, constant::TAB_SIZE, edit_map::EditMap};
+use alloc::{boxed::Box, string::String, vec, vec::Vec};
/// Containers.
///
@@ -725,14 +718,7 @@ fn push_impl(
None
};
- let visible = byte.map(|d| {
- if (b' '..=b'~').contains(&d) {
- str::from_utf8(&[d]).unwrap().to_string()
- } else {
- format!("0x{:x}", d)
- }
- });
- log::debug!("feed: `{:?}` to {:?}", visible, name);
+ log::debug!("feed: {} to {:?}", format_byte_opt(byte), name);
tokenizer.expect(byte);
state = call(tokenizer, name);
};