aboutsummaryrefslogtreecommitdiff
path: root/src/authority.rs
diff options
context:
space:
mode:
authorRichard Walters <rwalters@digitalstirling.com>2020-10-13 16:49:29 -0700
committerRichard Walters <rwalters@digitalstirling.com>2020-10-13 16:49:29 -0700
commit1aad71d0f34638864748eb3ecdc55daf48ab5ecd (patch)
treeff5a00e2349732fb67a64d519887185315fdb2c1 /src/authority.rs
parenta7e33fedada38f4454483eebb506633afde6be5e (diff)
Fix issue with naming
Use "to_" prefix instead of "as_" for functions which create values (expensive). See: https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv
Diffstat (limited to 'src/authority.rs')
-rw-r--r--src/authority.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/authority.rs b/src/authority.rs
index 2a2801c..d475f85 100644
--- a/src/authority.rs
+++ b/src/authority.rs
@@ -136,10 +136,10 @@ impl std::fmt::Display for Authority {
if let Some(userinfo) = &self.userinfo {
write!(f, "{}@", encode_element(&userinfo, &USER_INFO_NOT_PCT_ENCODED))?;
}
- let host_as_string = String::from_utf8(self.host.clone());
- match host_as_string {
- Ok(host_as_string) if validate_ipv6_address(&host_as_string).is_ok() => {
- write!(f, "[{}]", host_as_string.to_ascii_lowercase())?;
+ let host_to_string = String::from_utf8(self.host.clone());
+ match host_to_string {
+ Ok(host_to_string) if validate_ipv6_address(&host_to_string).is_ok() => {
+ write!(f, "[{}]", host_to_string.to_ascii_lowercase())?;
},
_ => {
write!(f, "{}", encode_element(&self.host, &REG_NAME_NOT_PCT_ENCODED))?;