mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-16 23:56:37 +00:00
Use CompactString::const_new
when possible
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
2bd9c1efee
commit
b8539071cd
3 changed files with 5 additions and 5 deletions
|
@ -197,7 +197,7 @@ mod test {
|
||||||
assert_matches!(deserialize("RATE_LIMITED"), GraphQLErrorType::RateLimited);
|
assert_matches!(deserialize("RATE_LIMITED"), GraphQLErrorType::RateLimited);
|
||||||
assert_matches!(
|
assert_matches!(
|
||||||
deserialize("rATE_LIMITED"),
|
deserialize("rATE_LIMITED"),
|
||||||
GraphQLErrorType::Other(val) if val == CompactString::new("rATE_LIMITED")
|
GraphQLErrorType::Other(val) if val == CompactString::const_new("rATE_LIMITED")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ root = "/some/path" # `cargo install` destination directory
|
||||||
assert_eq!(env.len(), 3);
|
assert_eq!(env.len(), 3);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
env.get("ENV_VAR_NAME").unwrap(),
|
env.get("ENV_VAR_NAME").unwrap(),
|
||||||
&Env::Value(CompactString::new("value"))
|
&Env::Value(CompactString::const_new("value"))
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
env.get("ENV_VAR_NAME_2").unwrap(),
|
env.get("ENV_VAR_NAME_2").unwrap(),
|
||||||
|
|
|
@ -96,10 +96,10 @@ pub(super) fn crate_prefix_components(
|
||||||
|
|
||||||
match (chars.next(), chars.next(), chars.next(), chars.next()) {
|
match (chars.next(), chars.next(), chars.next(), chars.next()) {
|
||||||
(None, None, None, None) => Err(RegistryError::NotFound(crate_name.into())),
|
(None, None, None, None) => Err(RegistryError::NotFound(crate_name.into())),
|
||||||
(Some(_), None, None, None) => Ok((CompactString::new("1"), None)),
|
(Some(_), None, None, None) => Ok((CompactString::const_new("1"), None)),
|
||||||
(Some(_), Some(_), None, None) => Ok((CompactString::new("2"), None)),
|
(Some(_), Some(_), None, None) => Ok((CompactString::const_new("2"), None)),
|
||||||
(Some(ch), Some(_), Some(_), None) => Ok((
|
(Some(ch), Some(_), Some(_), None) => Ok((
|
||||||
CompactString::new("3"),
|
CompactString::const_new("3"),
|
||||||
Some(ch.to_lowercase().to_compact_string()),
|
Some(ch.to_lowercase().to_compact_string()),
|
||||||
)),
|
)),
|
||||||
(Some(a), Some(b), Some(c), Some(d)) => Ok((
|
(Some(a), Some(b), Some(c), Some(d)) => Ok((
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue