Adds ordering on loader fields enum (#755)

* now sorts on ordering, fmt clippy prepare

* fixed tests

* removed accidenetal printlns
This commit is contained in:
Wyatt Verchere
2023-11-13 18:19:06 -08:00
committed by GitHub
parent ae1c5342f2
commit 375f992a0c
11 changed files with 56 additions and 32 deletions

View File

@@ -13,7 +13,7 @@ pub fn get_color_from_img(data: &[u8]) -> Result<Option<u32>, ImageError> {
.crop_imm(128, 128, 64, 64);
let color = color_thief::get_palette(image.to_rgb8().as_bytes(), ColorFormat::Rgb, 10, 2)
.ok()
.and_then(|x| x.get(0).copied())
.and_then(|x| x.first().copied())
.map(|x| (x.r as u32) << 16 | (x.g as u32) << 8 | (x.b as u32));
Ok(color)

View File

@@ -34,7 +34,7 @@ pub fn validation_errors_to_string(errors: ValidationErrors, adder: Option<Strin
output
}
ValidationErrorsKind::Field(errors) => {
if let Some(error) = errors.get(0) {
if let Some(error) = errors.first() {
if let Some(adder) = adder {
output.push_str(&format!(
"Field {} {} failed validation with error: {}",