Skip to content

Commit

Permalink
Cargo fmt and fixed test_get_value_u32
Browse files Browse the repository at this point in the history
  • Loading branch information
Mmh-zxz committed Jan 14, 2024
1 parent c41a7c4 commit 991a45b
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@ pub(crate) mod properties {
Key: AsRef<str>,
{
PROPERTIES.get(key.as_ref()).map_or(default, |value| {
value
.to_string()
.parse::<u32>()
.unwrap_or(default)
value.to_string().parse::<u32>().unwrap_or(default)
})
}

Expand All @@ -120,10 +117,7 @@ pub(crate) mod properties {
Key: AsRef<str>,
{
PROPERTIES.get(key.as_ref()).map_or(default, |value| {
value
.to_string()
.parse::<bool>()
.unwrap_or(default)
value.to_string().parse::<bool>().unwrap_or(default)
})
}
}
Expand Down Expand Up @@ -182,7 +176,6 @@ mod tests {
#[cfg(test)]
mod test_props {
use crate::api::constants::ENV_NACOS_CLIENT_NAMING_PUSH_EMPTY_PROTECTION;
use crate::api::constants::ENV_NACOS_CLIENT_COMMON_THREAD_CORES;
use crate::properties::{get_value, get_value_bool, get_value_u32};

#[test]
Expand All @@ -199,7 +192,8 @@ mod test_props {

#[test]
fn test_get_value_u32() {
let v = get_value_u32(ENV_NACOS_CLIENT_COMMON_THREAD_CORES, 91);
let not_exist_key = "MUST_NOT_EXIST";
let v = get_value_u32(not_exist_key, 91);
assert_eq!(v, 91);
}
}
Expand Down

0 comments on commit 991a45b

Please sign in to comment.