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

@@ -18,7 +18,7 @@
* This file has been modified from its original form in Barcode4J.
*/
use crate::common::{Result, CharacterSetECI};
use crate::common::{CharacterSetECI, Result};
use crate::Exceptions;
use super::{

View File

@@ -197,16 +197,17 @@ pub fn encodeHighLevel(
input = Box::new(NoECIInput::new(msg.to_owned()));
if encoding.is_none() {
encoding = Some(DEFAULT_ENCODING);
} else if &DEFAULT_ENCODING
!= encoding.as_ref().ok_or(Exceptions::ILLEGAL_STATE)?
{
} else if &DEFAULT_ENCODING != encoding.as_ref().ok_or(Exceptions::ILLEGAL_STATE)? {
// if let Some(eci) =
// CharacterSetECI::getCharacterSetECI(encoding.ok_or(Exceptions::ILLEGAL_STATE)?)
// {
// encodingECI(CharacterSetECI::getValue(&eci) as i32, &mut sb)?;
// }
encodingECI(CharacterSetECI::getValue(&encoding.ok_or(Exceptions::ILLEGAL_STATE)?) as i32, &mut sb)?;
encodingECI(
CharacterSetECI::getValue(&encoding.ok_or(Exceptions::ILLEGAL_STATE)?) as i32,
&mut sb,
)?;
}
}
@@ -778,12 +779,7 @@ fn determineConsecutiveBinaryCount<T: ECIInput + ?Sized + 'static>(
}
if let Some(encoder) = encoding {
let can_encode = encoder
.encode(
&input.charAt(idx)?.to_string()
)
.is_ok();
let can_encode = encoder.encode(&input.charAt(idx)?.to_string()).is_ok();
if !can_encode {
if TypeId::of::<T>() != TypeId::of::<NoECIInput>() {
@@ -866,7 +862,10 @@ impl Display for NoECIInput {
*/
#[cfg(test)]
mod PDF417EncoderTestCase {
use crate::{pdf417::encoder::{pdf_417_high_level_encoder::encodeHighLevel, Compaction}, common::CharacterSetECI};
use crate::{
common::CharacterSetECI,
pdf417::encoder::{pdf_417_high_level_encoder::encodeHighLevel, Compaction},
};
#[test]
fn testEncodeAuto() {

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
use crate::common::{Result, CharacterSetECI};
use crate::common::{CharacterSetECI, Result};
use super::{pdf_417_high_level_encoder, Compaction};

View File

@@ -17,7 +17,7 @@
use std::collections::HashMap;
use crate::{
common::{BitMatrix, Result, CharacterSetECI},
common::{BitMatrix, CharacterSetECI, Result},
BarcodeFormat, EncodeHintType, EncodeHintValue, Exceptions, Writer,
};