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:
@@ -62,18 +62,18 @@ pub fn parse(result: &RXingResult) -> Option<ParsedClientResult> {
|
||||
Vec::new()
|
||||
},
|
||||
Vec::new(),
|
||||
pronunciation.unwrap_or_default(), //"".to_owned(),
|
||||
pronunciation.unwrap_or_default(),
|
||||
phoneNumbers,
|
||||
Vec::new(),
|
||||
emails, //Vec::new(),
|
||||
Vec::new(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
note,
|
||||
addresses,
|
||||
Vec::new(),
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
Vec::new(),
|
||||
Vec::new(),
|
||||
) {
|
||||
|
||||
@@ -61,7 +61,7 @@ pub fn parse(result: &RXingResult) -> Option<ParsedClientResult> {
|
||||
.unwrap_or_default();
|
||||
if !ResultParser::isStringOfDigits(&birthday, 8) {
|
||||
// No reason to throw out the whole card because the birthday is formatted wrong.
|
||||
birthday = "".to_owned();
|
||||
birthday = String::default();
|
||||
}
|
||||
let urls = ResultParser::match_do_co_mo_prefixed_field("URL:", &rawText).unwrap_or_default();
|
||||
|
||||
@@ -78,13 +78,13 @@ pub fn parse(result: &RXingResult) -> Option<ParsedClientResult> {
|
||||
Vec::new(),
|
||||
emails,
|
||||
Vec::new(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
note,
|
||||
addresses,
|
||||
Vec::new(),
|
||||
org,
|
||||
birthday,
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
urls,
|
||||
Vec::new(),
|
||||
) {
|
||||
|
||||
@@ -83,18 +83,18 @@ impl AddressBookParsedRXingResult {
|
||||
Self::with_details(
|
||||
names,
|
||||
Vec::new(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
phone_numbers,
|
||||
phone_types,
|
||||
emails,
|
||||
email_types,
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
addresses,
|
||||
address_types,
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
Vec::new(),
|
||||
Vec::new(),
|
||||
)
|
||||
|
||||
@@ -63,17 +63,17 @@ pub fn parse(result: &RXingResult) -> Option<ParsedClientResult> {
|
||||
if let Ok(adb) = AddressBookParsedRXingResult::with_details(
|
||||
ResultParser::maybeWrap(Some(fullName))?,
|
||||
Vec::new(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
buildPhoneNumbers(phoneNumber1, phoneNumber2, phoneNumber3),
|
||||
Vec::new(),
|
||||
ResultParser::maybeWrap(Some(email))?,
|
||||
Vec::new(),
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
addresses?,
|
||||
Vec::new(),
|
||||
org,
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
title,
|
||||
Vec::new(),
|
||||
Vec::new(),
|
||||
|
||||
@@ -37,7 +37,7 @@ pub fn parse(result: &RXingResult) -> Option<ParsedClientResult> {
|
||||
if URIResultParser::is_basically_valid_uri(&uri) {
|
||||
Some(ParsedClientResult::URIResult(URIParsedRXingResult::new(
|
||||
uri,
|
||||
title.unwrap_or_else(|| "".to_owned()),
|
||||
title.unwrap_or_else(|| String::default()),
|
||||
)))
|
||||
} else {
|
||||
None
|
||||
|
||||
@@ -244,7 +244,7 @@ impl CalendarParsedRXingResult {
|
||||
|
||||
fn format_event(allDay: bool, date: i64) -> String {
|
||||
if date < 0 {
|
||||
return "".to_owned();
|
||||
return String::default();
|
||||
}
|
||||
let format_string = if allDay { "%F" } else { "%c" };
|
||||
// DateFormat format = allDay
|
||||
@@ -254,7 +254,7 @@ impl CalendarParsedRXingResult {
|
||||
if let Some(dtm) = NaiveDateTime::from_timestamp_opt(date, 0) {
|
||||
dtm.format(format_string).to_string()
|
||||
} else {
|
||||
String::from("")
|
||||
String::default()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ fn doTest(
|
||||
assert_eq!(
|
||||
endString,
|
||||
if calRXingResult.getEndTimestamp() < 0i64 {
|
||||
"".to_owned()
|
||||
String::default()
|
||||
} else {
|
||||
format_date_string(calRXingResult.getEndTimestamp(), dateFormat)
|
||||
// dateFormat.format(calRXingResult.getEndTimestamp())
|
||||
@@ -253,7 +253,7 @@ fn format_date_string(timestamp: i64, format_string: &str) -> String {
|
||||
if let Some(dtm) = NaiveDateTime::from_timestamp_opt(timestamp, 0) {
|
||||
dtm.format(format_string).to_string()
|
||||
} else {
|
||||
String::from("")
|
||||
String::default()
|
||||
}
|
||||
// DateTime::from(timestamp,0).with_timezone(Utc).format(format_string).to_string()
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@ impl EmailAddressParsedRXingResult {
|
||||
vec![to],
|
||||
Vec::new(),
|
||||
Vec::new(),
|
||||
"".to_owned(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -79,8 +79,8 @@ pub fn parse(result: &RXingResult) -> Option<ParsedClientResult> {
|
||||
let nameValues = ResultParser::parseNameValuePairs(&rawText);
|
||||
let mut ccs: Vec<String> = Vec::new();
|
||||
let mut bccs: Vec<String> = Vec::new();
|
||||
let mut subject = "".to_owned();
|
||||
let mut body = "".to_owned();
|
||||
let mut subject = String::default();
|
||||
let mut body = String::default();
|
||||
if let Some(nv) = nameValues {
|
||||
// if (nameValues != null) {
|
||||
if tos.is_empty() {
|
||||
@@ -115,8 +115,8 @@ pub fn parse(result: &RXingResult) -> Option<ParsedClientResult> {
|
||||
// if bccString != null {
|
||||
// bccs = COMMA.split(bccString);
|
||||
// }
|
||||
subject = nv.get("subject").unwrap_or(&"".to_owned()).clone();
|
||||
body = nv.get("body").unwrap_or(&"".to_owned()).clone();
|
||||
subject = nv.get("subject").unwrap_or(&String::default()).clone();
|
||||
body = nv.get("body").unwrap_or(&String::default()).clone();
|
||||
}
|
||||
Some(ParsedClientResult::EmailResult(
|
||||
EmailAddressParsedRXingResult::with_details(tos, ccs, bccs, subject, body),
|
||||
|
||||
@@ -52,19 +52,19 @@ pub fn parse(result: &crate::RXingResult) -> Option<super::ParsedClientResult> {
|
||||
}
|
||||
let rawText = ResultParser::getMassagedText(result);
|
||||
|
||||
let mut productID: String = "".to_owned(); // = null;
|
||||
let mut sscc: String = "".to_owned();
|
||||
let mut lotNumber: String = "".to_owned();
|
||||
let mut productionDate: String = "".to_owned();
|
||||
let mut packagingDate: String = "".to_owned();
|
||||
let mut bestBeforeDate: String = "".to_owned();
|
||||
let mut expirationDate: String = "".to_owned();
|
||||
let mut weight: String = "".to_owned();
|
||||
let mut weightType: String = "".to_owned();
|
||||
let mut weightIncrement: String = "".to_owned();
|
||||
let mut price: String = "".to_owned();
|
||||
let mut priceIncrement: String = "".to_owned();
|
||||
let mut priceCurrency: String = "".to_owned();
|
||||
let mut productID: String = String::default(); // = null;
|
||||
let mut sscc: String = String::default();
|
||||
let mut lotNumber: String = String::default();
|
||||
let mut productionDate: String = String::default();
|
||||
let mut packagingDate: String = String::default();
|
||||
let mut bestBeforeDate: String = String::default();
|
||||
let mut expirationDate: String = String::default();
|
||||
let mut weight: String = String::default();
|
||||
let mut weightType: String = String::default();
|
||||
let mut weightIncrement: String = String::default();
|
||||
let mut price: String = String::default();
|
||||
let mut priceIncrement: String = String::default();
|
||||
let mut priceCurrency: String = String::default();
|
||||
let mut uncommonAIs = HashMap::new();
|
||||
|
||||
let mut i = 0;
|
||||
|
||||
@@ -503,7 +503,7 @@ fn format_date(year: i32, month: u32, day: u32) -> String {
|
||||
if let LocalResult::Single(dtm) = Utc.with_ymd_and_hms(year, month, day, 0, 0, 0) {
|
||||
dtm.format("%F").to_string()
|
||||
} else {
|
||||
String::from("")
|
||||
String::default()
|
||||
}
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.clear();
|
||||
@@ -517,7 +517,7 @@ fn format_time(year: i32, month: u32, day: u32, hour: u32, min: u32, sec: u32) -
|
||||
|
||||
dtm.format("%c").to_string()
|
||||
} else {
|
||||
String::from("")
|
||||
String::default()
|
||||
}
|
||||
// Calendar cal = Calendar.getInstance();
|
||||
// cal.clear();
|
||||
|
||||
@@ -167,7 +167,7 @@ pub fn parseRXingResult(the_rxing_result: &RXingResult) -> ParsedClientResult {
|
||||
|
||||
ParsedClientResult::TextResult(TextParsedRXingResult::new(
|
||||
the_rxing_result.getText().to_owned(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
))
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ pub fn appendKeyValue(keyValue: &str, result: &mut HashMap<String, String>) {
|
||||
|
||||
let kvp: Vec<&str> = keyValueTokens.take(2).collect();
|
||||
if let [key, value] = kvp[..] {
|
||||
let p_value = urlDecode(value).unwrap_or_else(|_| "".to_owned());
|
||||
let p_value = urlDecode(value).unwrap_or_else(|_| String::default());
|
||||
result.insert(key.to_owned(), p_value);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,15 +54,15 @@ pub fn parse(result: &RXingResult) -> Option<ParsedClientResult> {
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut subject = "".to_owned();
|
||||
let mut body = "".to_owned();
|
||||
let mut subject = String::default();
|
||||
let mut body = String::default();
|
||||
let mut querySyntax = false;
|
||||
|
||||
// Check up front if this is a URI syntax string with query arguments
|
||||
if let Some(name_value_pairs) = ResultParser::parseNameValuePairs(&raw_text) {
|
||||
if !name_value_pairs.is_empty() {
|
||||
subject = String::from(name_value_pairs.get("subject").unwrap_or(&"".to_owned()));
|
||||
body = String::from(name_value_pairs.get("body").unwrap_or(&"".to_owned()));
|
||||
subject = String::from(name_value_pairs.get("subject").unwrap_or(&String::default()));
|
||||
body = String::from(name_value_pairs.get("body").unwrap_or(&String::default()));
|
||||
querySyntax = true;
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ fn add_number_via(numbers: &mut Vec<String>, vias: &mut Vec<String>, number_part
|
||||
}
|
||||
} else {
|
||||
numbers.push(number_part.to_owned());
|
||||
//vias.push("".to_owned());
|
||||
//vias.push(String::default());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ pub fn parse(result: &RXingResult) -> Option<ParsedClientResult> {
|
||||
Some(ParsedClientResult::SMSResult(
|
||||
SMSParsedRXingResult::with_singles(
|
||||
number.to_owned(),
|
||||
String::from(""),
|
||||
String::from(""),
|
||||
String::default(),
|
||||
String::default(),
|
||||
body.to_owned(),
|
||||
),
|
||||
))
|
||||
|
||||
@@ -51,7 +51,7 @@ pub fn parse(theRXingResult: &crate::RXingResult) -> Option<ParsedClientResult>
|
||||
Some(ParsedClientResult::TelResult(TelParsedRXingResult::new(
|
||||
number.to_owned(),
|
||||
telURI,
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
)))
|
||||
}
|
||||
// }
|
||||
|
||||
@@ -59,7 +59,7 @@ pub fn parse(result: &RXingResult) -> Option<ParsedClientResult> {
|
||||
if raw_text.starts_with("URL:") || raw_text.starts_with("URI:") {
|
||||
return Some(ParsedClientResult::URIResult(URIParsedRXingResult::new(
|
||||
raw_text[4..].trim().to_owned(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
)));
|
||||
// return new URIParsedRXingResult(rawText.substring(4).trim(), null);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ pub fn parse(result: &RXingResult) -> Option<ParsedClientResult> {
|
||||
}
|
||||
Some(ParsedClientResult::URIResult(URIParsedRXingResult::new(
|
||||
raw_text.to_owned(),
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
)))
|
||||
}
|
||||
|
||||
|
||||
@@ -116,10 +116,10 @@ pub fn parse(result: &RXingResult) -> Option<ParsedClientResult> {
|
||||
if isLikeVCardDate(&bday_array[0]) {
|
||||
bday_array
|
||||
} else {
|
||||
vec!["".to_owned()]
|
||||
vec![String::default()]
|
||||
}
|
||||
} else {
|
||||
vec!["".to_owned()]
|
||||
vec![String::default()]
|
||||
};
|
||||
// if birthday != null && !isLikeVCardDate(birthday.get(0)) {
|
||||
// birthday = null;
|
||||
@@ -143,7 +143,7 @@ pub fn parse(result: &RXingResult) -> Option<ParsedClientResult> {
|
||||
if let Ok(adb) = AddressBookParsedRXingResult::with_details(
|
||||
toPrimaryValues(Some(names)),
|
||||
nicknames,
|
||||
"".to_owned(),
|
||||
String::default(),
|
||||
toPrimaryValues(phoneNumbers.clone()),
|
||||
toTypes(phoneNumbers),
|
||||
toPrimaryValues(emails.clone()),
|
||||
@@ -416,7 +416,7 @@ fn maybeAppendFragment(fragmentBuffer: &mut Vec<u8>, charset: &str, result: &mut
|
||||
let fragmentBytes = fragmentBuffer.clone();
|
||||
let fragment;
|
||||
if charset.is_empty() {
|
||||
fragment = String::from_utf8(fragmentBytes).unwrap_or_else(|_| "".to_owned());
|
||||
fragment = String::from_utf8(fragmentBytes).unwrap_or_else(|_| String::default());
|
||||
// fragment = new String(fragmentBytes, StandardCharsets.UTF_8);
|
||||
} else if let Some(enc) = encoding::label::encoding_from_whatwg_label(charset) {
|
||||
fragment = if let Ok(encoded_result) =
|
||||
@@ -424,10 +424,10 @@ fn maybeAppendFragment(fragmentBuffer: &mut Vec<u8>, charset: &str, result: &mut
|
||||
{
|
||||
encoded_result
|
||||
} else {
|
||||
String::from_utf8(fragmentBytes).unwrap_or_else(|_| "".to_owned())
|
||||
String::from_utf8(fragmentBytes).unwrap_or_else(|_| String::default())
|
||||
}
|
||||
} else {
|
||||
fragment = String::from_utf8(fragmentBytes).unwrap_or_else(|_| "".to_owned())
|
||||
fragment = String::from_utf8(fragmentBytes).unwrap_or_else(|_| String::default())
|
||||
}
|
||||
fragmentBuffer.clear();
|
||||
result.push_str(&fragment);
|
||||
@@ -451,19 +451,13 @@ pub fn matchSingleVCardPrefixedField(
|
||||
fn toPrimaryValue(list: Option<Vec<String>>) -> String {
|
||||
if let Some(l) = list {
|
||||
if l.is_empty() {
|
||||
"".to_owned()
|
||||
String::default()
|
||||
} else {
|
||||
l.get(0).unwrap_or(&"".to_owned()).clone()
|
||||
l.get(0).unwrap_or(&String::default()).clone()
|
||||
}
|
||||
} else {
|
||||
"".to_owned()
|
||||
String::default()
|
||||
}
|
||||
// if list.is_empty() {
|
||||
// "".to_owned()
|
||||
// }else {
|
||||
// *list.get(0).unwrap_or(&"".to_owned())
|
||||
// }
|
||||
// return list == null || list.isEmpty() ? null : list.get(0);
|
||||
}
|
||||
|
||||
fn toPrimaryValues(lists: Option<Vec<Vec<String>>>) -> Vec<String> {
|
||||
@@ -496,11 +490,11 @@ fn toTypes(lists: Option<Vec<Vec<String>>>) -> Vec<String> {
|
||||
if let Some(value) = list.get(0) {
|
||||
if !value.is_empty() {
|
||||
let mut v_type = String::new();
|
||||
let final_value = list.last().unwrap_or(&"".to_owned()).clone();
|
||||
let final_value = list.last().unwrap_or(&String::default()).clone();
|
||||
if !final_value.is_empty() {
|
||||
for i in 0..list.len() - 1 {
|
||||
// for (int i = 1; i < list.size(); i++) {
|
||||
let metadatum = list.get(i).unwrap_or(&"".to_owned()).clone();
|
||||
let metadatum = list.get(i).unwrap_or(&String::default()).clone();
|
||||
if let Some(equals) = metadatum.find('=') {
|
||||
if "TYPE" == (metadatum[0..equals]).to_uppercase() {
|
||||
v_type = metadatum[equals + 1..].to_owned();
|
||||
@@ -544,12 +538,12 @@ fn formatNames(names: &mut Vec<Vec<String>>) {
|
||||
for list in names {
|
||||
// for (List<String> list : names) {
|
||||
let mut pos = 0;
|
||||
while let Some(_fnd) = list.get(pos).unwrap_or(&"".to_owned()).find('=') {
|
||||
while let Some(_fnd) = list.get(pos).unwrap_or(&String::default()).find('=') {
|
||||
pos += 1;
|
||||
}
|
||||
let name = list.get(pos).unwrap_or(&"".to_owned()).clone();
|
||||
let name = list.get(pos).unwrap_or(&String::default()).clone();
|
||||
|
||||
let mut components = vec!["".to_owned(); 5];
|
||||
let mut components = vec![String::default(); 5];
|
||||
let mut start = 0;
|
||||
let mut end = 0;
|
||||
let mut componentIndex = 0;
|
||||
|
||||
@@ -118,26 +118,26 @@ fn matchSingleVCardPrefixedField(prefix: &str, rawText: &str) -> String {
|
||||
VCardResultParser::matchSingleVCardPrefixedField(prefix, rawText, true, false)
|
||||
{
|
||||
if values.is_empty() {
|
||||
"".to_owned()
|
||||
String::default()
|
||||
} else {
|
||||
let tz_mod = if values.len() > 1 {
|
||||
if let Some(v) = values.get(values.len() - 2) {
|
||||
if let Some(tz_loc) = v.find("TZID=") {
|
||||
v[tz_loc + 5..].to_owned()
|
||||
} else {
|
||||
"".to_owned()
|
||||
String::default()
|
||||
}
|
||||
} else {
|
||||
"".to_owned()
|
||||
String::default()
|
||||
}
|
||||
} else {
|
||||
"".to_owned()
|
||||
String::default()
|
||||
};
|
||||
let root_time = values.last().unwrap().clone();
|
||||
format!("{root_time}{tz_mod}")
|
||||
}
|
||||
} else {
|
||||
"".to_owned()
|
||||
String::default()
|
||||
}
|
||||
// return values == null || values.isEmpty() ? null : values.get(0);
|
||||
}
|
||||
@@ -148,7 +148,7 @@ fn matchVCardPrefixedField(prefix: &str, rawText: &str) -> Vec<String> {
|
||||
Vec::new()
|
||||
} else {
|
||||
let size = values.len();
|
||||
let mut result = vec!["".to_owned(); size]; //new String[size];
|
||||
let mut result = vec![String::default(); size]; //new String[size];
|
||||
for (i, res) in result.iter_mut().enumerate().take(size) {
|
||||
// for i in 0..size {
|
||||
// for (int i = 0; i < size; i++) {
|
||||
|
||||
@@ -67,10 +67,10 @@ impl WifiParsedRXingResult {
|
||||
ssid,
|
||||
password,
|
||||
hidden,
|
||||
String::from(""),
|
||||
String::from(""),
|
||||
String::from(""),
|
||||
String::from(""),
|
||||
String::default(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
String::default(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -52,12 +52,12 @@ pub fn parse(theRXingResult: &crate::RXingResult) -> Option<super::ParsedClientR
|
||||
}
|
||||
let rawText = rawText_unstripped[WIFI_TEST.len()..].to_owned();
|
||||
let ssid = ResultParser::matchSinglePrefixedField("S:", &rawText, ';', false)
|
||||
.unwrap_or_else(|| String::from(""));
|
||||
.unwrap_or_else(|| String::default());
|
||||
if ssid.is_empty() {
|
||||
return None;
|
||||
}
|
||||
let pass = ResultParser::matchSinglePrefixedField("P:", &rawText, ';', false)
|
||||
.unwrap_or_else(|| String::from(""));
|
||||
.unwrap_or_else(|| String::default());
|
||||
let n_type =
|
||||
if let Some(nt) = ResultParser::matchSinglePrefixedField("T:", &rawText, ';', false) {
|
||||
nt
|
||||
@@ -81,15 +81,15 @@ pub fn parse(theRXingResult: &crate::RXingResult) -> Option<super::ParsedClientR
|
||||
}
|
||||
hv
|
||||
} else {
|
||||
String::from("")
|
||||
String::default()
|
||||
};
|
||||
|
||||
let identity = ResultParser::matchSinglePrefixedField("I:", &rawText, ';', false)
|
||||
.unwrap_or_else(|| String::from(""));
|
||||
.unwrap_or_else(|| String::default());
|
||||
let anonymousIdentity = ResultParser::matchSinglePrefixedField("A:", &rawText, ';', false)
|
||||
.unwrap_or_else(|| String::from(""));
|
||||
.unwrap_or_else(|| String::default());
|
||||
let eapMethod = ResultParser::matchSinglePrefixedField("E:", &rawText, ';', false)
|
||||
.unwrap_or_else(|| String::from(""));
|
||||
.unwrap_or_else(|| String::default());
|
||||
|
||||
Some(ParsedClientResult::WiFiResult(
|
||||
WifiParsedRXingResult::with_details(
|
||||
@@ -100,7 +100,7 @@ pub fn parse(theRXingResult: &crate::RXingResult) -> Option<super::ParsedClientR
|
||||
identity,
|
||||
anonymousIdentity,
|
||||
eapMethod,
|
||||
phase2Method.unwrap_or_else(|| String::from("")),
|
||||
phase2Method.unwrap_or_else(|| String::default()),
|
||||
),
|
||||
))
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
);
|
||||
|
||||
|
||||
@@ -476,7 +476,7 @@ fn generatePermutation(index: u32, length: u32, chars: &[char]) -> String {
|
||||
baseNNumber.insert(0, '0');
|
||||
// baseNNumber = "0" + baseNNumber;
|
||||
}
|
||||
let mut prefix = String::from("");
|
||||
let mut prefix = String::default();
|
||||
for ch in baseNNumber.chars() {
|
||||
prefix.push(chars[(ch as isize - '0' as isize) as usize]);
|
||||
}
|
||||
|
||||
@@ -509,7 +509,7 @@ impl<T: Reader> AbstractBlackBoxTestCase<T> {
|
||||
read_to_string(&file).expect("ok")
|
||||
}
|
||||
} else {
|
||||
"".to_owned()
|
||||
String::default()
|
||||
};
|
||||
// let string_contents = read_to_string(&file)?; //new String(Files.readAllBytes(file), charset);
|
||||
if string_contents.ends_with('\n') {
|
||||
|
||||
@@ -651,7 +651,7 @@ impl<T: MultipleBarcodeReader + Reader> PDF417MultiImageSpanAbstractBlackBoxTest
|
||||
read_to_string(&file).expect("ok")
|
||||
}
|
||||
} else {
|
||||
"".to_owned()
|
||||
String::default()
|
||||
};
|
||||
// let string_contents = read_to_string(&file)?; //new String(Files.readAllBytes(file), charset);
|
||||
if string_contents.ends_with('\n') {
|
||||
|
||||
Reference in New Issue
Block a user