cargo clippy && fmt

This commit is contained in:
Henry Schimke
2023-03-02 15:54:40 -06:00
parent a0b8b68869
commit 9431031147
28 changed files with 111 additions and 135 deletions

View File

@@ -16,7 +16,7 @@
use std::rc::Rc;
use crate::common::{Result, CharacterSetECI};
use crate::common::{CharacterSetECI, Result};
use crate::{Dimension, Exceptions};
use super::{SymbolInfo, SymbolInfoLookup, SymbolShapeHint};
@@ -57,14 +57,10 @@ impl<'a> EncoderContext<'_> {
// }
// sb.append(ch);
// }
let sb = if let Ok(encoded_bytes) =
ISO_8859_1_ENCODER.encode(msg)
{
ISO_8859_1_ENCODER
.decode(&encoded_bytes)
.map_err(|e| {
Exceptions::parse_with(format!("round trip decode should always work: {e}"))
})?
let sb = if let Ok(encoded_bytes) = ISO_8859_1_ENCODER.encode(msg) {
ISO_8859_1_ENCODER.decode(&encoded_bytes).map_err(|e| {
Exceptions::parse_with(format!("round trip decode should always work: {e}"))
})?
} else {
return Err(Exceptions::illegal_argument_with(
"Message contains characters outside ISO-8859-1 encoding.",

View File

@@ -18,7 +18,10 @@ use std::rc::Rc;
use once_cell::sync::Lazy;
use crate::{datamatrix::encoder::{SymbolInfo, SymbolShapeHint}, common::CharacterSetECI};
use crate::{
common::CharacterSetECI,
datamatrix::encoder::{SymbolInfo, SymbolShapeHint},
};
use super::{high_level_encoder, minimal_encoder, symbol_info, SymbolInfoLookup};

View File

@@ -16,7 +16,7 @@
use std::rc::Rc;
use crate::common::{Result, CharacterSetECI};
use crate::common::{CharacterSetECI, Result};
use crate::{Dimension, Exceptions};
use super::{

View File

@@ -17,7 +17,7 @@
use std::{fmt, rc::Rc};
use crate::{
common::{ECIInput, MinimalECIInput, Result, CharacterSetECI},
common::{CharacterSetECI, ECIInput, MinimalECIInput, Result},
Exceptions,
};
@@ -171,10 +171,7 @@ pub fn encodeHighLevelWithDetails(
msg = &msg[high_level_encoder::MACRO_06_HEADER.chars().count()..(msg.chars().count() - 2)];
}
Ok(ISO_8859_1_ENCODER
.decode(
&encode(msg, priorityCharset, fnc1, shape, macroId)?
)
.decode(&encode(msg, priorityCharset, fnc1, shape, macroId)?)
.expect("should decode"))
// return new String(encode(msg, priorityCharset, fnc1, shape, macroId), StandardCharsets.ISO_8859_1);
}