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

View file

@ -3,7 +3,8 @@
// For the full copyright and license information, please view the LICENSE // For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code. // 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 crate::error::{UResult, USimpleError};
use data_encoding::Encoding; use data_encoding::Encoding;