summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToby Vincent <tobyv13@gmail.com>2022-12-03 21:54:02 -0600
committerToby Vincent <tobyv13@gmail.com>2022-12-03 21:54:02 -0600
commit32fa816a16c6ba5a26ad69fb8f30134836a093f5 (patch)
tree610d44cb7be2ba569f6d3beffc563be5bdbbe0b6
parent70ee2f14ca1de7e1393907c00f323325564cdddd (diff)
refactor: inline UNKNOWN const
-rw-r--r--src/lib.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 8838b26..92c8b3a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -30,8 +30,6 @@ Examples:
cat f - g Output f's contents, then standard input, then g's contents.
cat Copy standard input to standard output."#;
-const UNKNOWN_CHAR: &[u8; 2] = b"^?";
-
pub fn run(cli: Cli) -> Result<()> {
let stdout = std::io::stdout();
let mut writer = stdout.lock();
@@ -97,7 +95,7 @@ fn process_nonprinting(mut c: u8) -> Vec<u8> {
match c {
c @ 0..=31 => buf.extend([b'^', c + 64]),
c @ 32..=126 => buf.push(c),
- 127.. => buf.extend(UNKNOWN_CHAR),
+ 127.. => buf.extend(b"^?"),
};
buf