Fix spelling exception comment

This commit is contained in:
Andrew Liebenow 2024-09-24 19:56:50 -05:00
parent 70c3f49430
commit 2c25ae2838
2 changed files with 12 additions and 10 deletions

View file

@ -740,16 +740,17 @@ fn format_read_error(kind: ErrorKind) -> String {
let kind_string = kind.to_string();
// e.g. "is a directory" -> "Is a directory"
let kind_string_capitalized = kind_string
.char_indices()
.map(|(index, character)| {
if index == 0 {
character.to_uppercase().collect::<String>()
} else {
character.to_string()
let mut kind_string_capitalized = String::with_capacity(kind_string.len());
for (index, ch) in kind_string.char_indices() {
if index == 0 {
for cha in ch.to_uppercase() {
kind_string_capitalized.push(cha);
}
})
.collect::<String>();
} else {
kind_string_capitalized.push(ch);
}
}
format!("read error: {kind_string_capitalized}")
}

View file

@ -3,7 +3,8 @@
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore (encodings) lsbf msbf unpadded
// spell-checker:ignore (encodings) lsbf msbf
// spell-checker:ignore unpadded
use crate::error::{UResult, USimpleError};
use data_encoding::Encoding;