mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
standardize empty string to String::default()
This replaces "".to_owned() "".to_string() and String::from("")
This commit is contained in:
@@ -139,7 +139,7 @@ static FOUR_DIGIT_DATA_LENGTH: Lazy<HashMap<String, DataLength>> = Lazy::new(||
|
||||
|
||||
pub fn parseFieldsInGeneralPurpose(rawInformation: &str) -> Result<String, Exceptions> {
|
||||
if rawInformation.is_empty() {
|
||||
return Ok("".to_owned());
|
||||
return Ok(String::default());
|
||||
}
|
||||
|
||||
// Processing 2-digit AIs
|
||||
|
||||
@@ -57,7 +57,7 @@ impl<'a> GeneralAppIdDecoder<'_> {
|
||||
) -> Result<String, Exceptions> {
|
||||
let mut buff = buff;
|
||||
let mut currentPosition = initialPosition;
|
||||
let mut remaining = "".to_owned();
|
||||
let mut remaining = String::default();
|
||||
loop {
|
||||
let info = self.decodeGeneralPurposeField(currentPosition, &remaining)?;
|
||||
let parsedFields = field_parser::parseFieldsInGeneralPurpose(info.getNewString())?;
|
||||
@@ -67,7 +67,7 @@ impl<'a> GeneralAppIdDecoder<'_> {
|
||||
if info.isRemaining() {
|
||||
remaining = info.getRemainingValue().to_string();
|
||||
} else {
|
||||
remaining = "".to_owned();
|
||||
remaining = String::default();
|
||||
}
|
||||
|
||||
if currentPosition == info.getNewPosition() {
|
||||
|
||||
@@ -49,18 +49,18 @@ fn testDecodeRow2result2() {
|
||||
let expected = ExpandedProductParsedRXingResult::new(
|
||||
"(01)90012345678908(3103)001750".to_owned(),
|
||||
"90012345678908".to_owned(),
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
"001750".to_owned(),
|
||||
ExpandedProductParsedRXingResult::KILOGRAM.to_owned(),
|
||||
"3".to_owned(),
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
HashMap::new(),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user