mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
cargo clippy && fmt
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
common::{BitMatrix, Result, CharacterSetECI},
|
||||
common::{BitMatrix, CharacterSetECI, Result},
|
||||
qrcode::encoder::ByteMatrix,
|
||||
BarcodeFormat, EncodeHintType, EncodeHintValue, Exceptions, Writer,
|
||||
};
|
||||
@@ -122,7 +122,8 @@ impl Writer for DataMatrixWriter {
|
||||
hints.get(&EncodeHintType::CHARACTER_SET) else {
|
||||
return Err(Exceptions::illegal_argument_with("charset does not exist"))
|
||||
};
|
||||
charset = CharacterSetECI::getCharacterSetECIByName(char_set_name);//encoding::label::encoding_from_whatwg_label(char_set_name);
|
||||
charset = CharacterSetECI::getCharacterSetECIByName(char_set_name);
|
||||
//encoding::label::encoding_from_whatwg_label(char_set_name);
|
||||
// charset = Charset.forName(hints.get(EncodeHintType.CHARACTER_SET).toString());
|
||||
}
|
||||
encoded = minimal_encoder::encodeHighLevelWithDetails(
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
use crate::{
|
||||
common::{BitSource, DecoderRXingResult, ECIStringBuilder, Result, CharacterSetECI},
|
||||
common::{BitSource, CharacterSetECI, DecoderRXingResult, ECIStringBuilder, Result},
|
||||
Exceptions,
|
||||
};
|
||||
|
||||
@@ -727,12 +727,7 @@ fn decodeBase256Segment(
|
||||
*byte = unrandomize255State(bits.readBits(8)?, codewordPosition) as u8;
|
||||
codewordPosition += 1;
|
||||
}
|
||||
result.append_string(
|
||||
|
||||
&CharacterSetECI::ISO8859_1
|
||||
.decode(&bytes)
|
||||
?,
|
||||
);
|
||||
result.append_string(&CharacterSetECI::ISO8859_1.decode(&bytes)?);
|
||||
byteSegments.push(bytes);
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -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.",
|
||||
|
||||
@@ -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};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
use crate::common::{Result, CharacterSetECI};
|
||||
use crate::common::{CharacterSetECI, Result};
|
||||
use crate::{Dimension, Exceptions};
|
||||
|
||||
use super::{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user