mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 21:02:35 +00:00
Implement clippy suggestions
This commit is contained in:
@@ -23,15 +23,9 @@ use super::{Code93Reader, OneDimensionalCodeWriter};
|
||||
/**
|
||||
* This object renders a CODE93 code as a BitMatrix
|
||||
*/
|
||||
#[derive(OneDWriter)]
|
||||
#[derive(OneDWriter, Default)]
|
||||
pub struct Code93Writer;
|
||||
|
||||
impl Default for Code93Writer {
|
||||
fn default() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl OneDimensionalCodeWriter for Code93Writer {
|
||||
/**
|
||||
* @param contents barcode contents to encode. It should not be encoded for extended characters.
|
||||
@@ -41,7 +35,7 @@ impl OneDimensionalCodeWriter for Code93Writer {
|
||||
let mut contents = Self::convertToExtended(contents)?;
|
||||
let length = contents.chars().count();
|
||||
if length > 80 {
|
||||
return Err(Exceptions::IllegalArgumentException(format!("Requested contents should be less than 80 digits long after converting to extended encoding, but got {}" , length)));
|
||||
return Err(Exceptions::IllegalArgumentException(Some(format!("Requested contents should be less than 80 digits long after converting to extended encoding, but got {}" , length))));
|
||||
}
|
||||
|
||||
//length of code + 2 start/stop characters + 2 checksums, each of 9 bits, plus a termination bar
|
||||
@@ -202,10 +196,10 @@ impl Code93Writer {
|
||||
extendedContent
|
||||
.push(char::from_u32('P' as u32 + character as u32 - '{' as u32).unwrap());
|
||||
} else {
|
||||
return Err(Exceptions::IllegalArgumentException(format!(
|
||||
return Err(Exceptions::IllegalArgumentException(Some(format!(
|
||||
"Requested content contains a non-encodable character: '{}'",
|
||||
character
|
||||
)));
|
||||
))));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user