From: Alexander McLin Date: Tue, 14 Apr 2026 19:27:52 +0000 (-0400) Subject: Issue 3264 add rationale comment & `#[allow(...)]` X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=b6db1cde253f22482714b7f7ccd08bba766c1f28;p=scryer-prolog.git Issue 3264 add rationale comment & `#[allow(...)]` Explain why no multibyte UTF-8 encoding support Disable `bytes()` clippy warning about performance penalty due to unbuffered bytes --- diff --git a/src/read/fallback_mode.rs b/src/read/fallback_mode.rs index 759ac890..1123a2b2 100644 --- a/src/read/fallback_mode.rs +++ b/src/read/fallback_mode.rs @@ -6,9 +6,19 @@ use std::io::{Error, ErrorKind, Read}; // // Retrieve a single byte from stdin, does not support full Unicode decoding; only convert // byte to KeyEvent char if it falls within the ASCII subset of UTF-8. -// // Does not support passing through Ctrl-C as a KeyEvent. +// +// We are not supporting multibyte UTF-8 encodings because we are only +// interested in single ASCII characters which are 1-byte UTF-8 characters. +// Multibyte non-ASCII characters would be ignored anyway, so it's not worth the effort. +// +// It is expected that `limited_support_read` will only be used when prompting for user +// input during solution enumeration and the available commands are single ASCII characters. pub(crate) fn limited_support_read() -> std::io::Result { + #[allow( + clippy::unbuffered_bytes, + reason = "We are aware of `bytes()` performance pitfall but don't expect it to be relevant here, we are doing single byte user input I/O." + )] let byte_or_none = std::io::stdin().bytes().next(); match byte_or_none {