use to_string instead of to_owned where applicable
This commit is contained in:
parent
a7cddf3205
commit
67b048f9ac
2 changed files with 11 additions and 11 deletions
|
|
@ -117,23 +117,23 @@ mod tests {
|
||||||
for input in inputs {
|
for input in inputs {
|
||||||
{
|
{
|
||||||
// check AliasID
|
// check AliasID
|
||||||
let _ = AliasID(input.to_owned()); // direct creation
|
let _ = AliasID(input.to_string()); // direct creation
|
||||||
let aid = AliasID::from(input.to_owned());
|
let aid = AliasID::from(input.to_string());
|
||||||
check_trait(&input, &aid.0, "From<String>", "AliasID");
|
check_trait(&input, &aid.0, "From<String>", "AliasID");
|
||||||
check_trait(&input, &aid.as_ref(), "AsRef<str>", "AliasID");
|
check_trait(&input, &aid.as_ref(), "AsRef<str>", "AliasID");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// check ShareID
|
// check ShareID
|
||||||
let _ = ShareID(input.to_owned()); // direct creation
|
let _ = ShareID(input.to_string()); // direct creation
|
||||||
let sid = ShareID::from(input.to_owned());
|
let sid = ShareID::from(input.to_string());
|
||||||
check_trait(&input, &sid.0, "From<String>", "ShareID");
|
check_trait(&input, &sid.0, "From<String>", "ShareID");
|
||||||
check_trait(&input, &sid.to_string(), "Display", "ShareID");
|
check_trait(&input, &sid.to_string(), "Display", "ShareID");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// check FileID
|
// check FileID
|
||||||
let fid = FileID(input.to_owned()); // direct creation
|
let fid = FileID(input.to_string()); // direct creation
|
||||||
check_trait(&input, &fid.to_string(), "Display", "FileID");
|
check_trait(&input, &fid.to_string(), "Display", "FileID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +183,7 @@ mod tests {
|
||||||
];
|
];
|
||||||
|
|
||||||
for bad in bad_inputs {
|
for bad in bad_inputs {
|
||||||
let err = FileID::try_from(bad.to_owned()).expect_err("URL should not parse");
|
let err = FileID::try_from(bad.to_string()).expect_err("URL should not parse");
|
||||||
// make sure it's the Mismatch variant, and that it contains the original input
|
// make sure it's the Mismatch variant, and that it contains the original input
|
||||||
match err {
|
match err {
|
||||||
crate::Error::Mismatch { expected, actual } => {
|
crate::Error::Mismatch { expected, actual } => {
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ mod tests {
|
||||||
];
|
];
|
||||||
|
|
||||||
for uri_data in cases {
|
for uri_data in cases {
|
||||||
let uri = Uri(uri_data.to_owned());
|
let uri = Uri(uri_data.to_string());
|
||||||
check_trait(&uri_data, &uri.to_string(), "Display", "Uri");
|
check_trait(&uri_data, &uri.to_string(), "Display", "Uri");
|
||||||
check_trait(&uri_data.as_bytes(), &uri.as_ref(), "AsRef<[u8]>", "Uri");
|
check_trait(&uri_data.as_bytes(), &uri.as_ref(), "AsRef<[u8]>", "Uri");
|
||||||
}
|
}
|
||||||
|
|
@ -182,7 +182,7 @@ mod tests {
|
||||||
("12345", "/api/v2/12345"),
|
("12345", "/api/v2/12345"),
|
||||||
];
|
];
|
||||||
|
|
||||||
let uri = Uri("".to_owned());
|
let uri = Uri("".to_string());
|
||||||
for (path, expected) in cases {
|
for (path, expected) in cases {
|
||||||
assert_eq!(&expected, &uri.endpoint(format_args!("{path}")));
|
assert_eq!(&expected, &uri.endpoint(format_args!("{path}")));
|
||||||
}
|
}
|
||||||
|
|
@ -190,9 +190,9 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_pub_endpoints() {
|
fn test_pub_endpoints() {
|
||||||
let uri = Uri("".to_owned());
|
let uri = Uri("".to_string());
|
||||||
let share_id = ShareID("sid".to_owned());
|
let share_id = ShareID("sid".to_string());
|
||||||
let file_id = FileID("fid".to_owned());
|
let file_id = FileID("fid".to_string());
|
||||||
|
|
||||||
assert_eq!("/api/v2/alias/upload/new", uri.share_create());
|
assert_eq!("/api/v2/alias/upload/new", uri.share_create());
|
||||||
assert_eq!("/api/v2/alias/mail/notify/sid", uri.share_notify(&share_id));
|
assert_eq!("/api/v2/alias/mail/notify/sid", uri.share_notify(&share_id));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue