format string readability improvement

This commit is contained in:
Scott Lamb 2023-02-11 12:20:36 -08:00
parent 321c95a88c
commit 64d161d0a7
No known key found for this signature in database

View File

@ -126,13 +126,12 @@ pub fn run(args: Args) -> Result<i32, Error> {
fn curl_cookie(cookie: &str, flags: i32, domain: &str) -> String { fn curl_cookie(cookie: &str, flags: i32, domain: &str) -> String {
format!( format!(
"{httponly}{domain}\t{tailmatch}\t{path}\t{secure}\t{expires}\t{name}\t{value}", "{httponly}{domain}\t{tailmatch}\t{path}\t{secure}\t{expires}\t{name}\t{cookie}",
httponly = if (flags & SessionFlag::HttpOnly as i32) != 0 { httponly = if (flags & SessionFlag::HttpOnly as i32) != 0 {
"#HttpOnly_" "#HttpOnly_"
} else { } else {
"" ""
}, },
domain = domain,
tailmatch = "FALSE", tailmatch = "FALSE",
path = "/", path = "/",
secure = if (flags & SessionFlag::Secure as i32) != 0 { secure = if (flags & SessionFlag::Secure as i32) != 0 {
@ -142,7 +141,6 @@ fn curl_cookie(cookie: &str, flags: i32, domain: &str) -> String {
}, },
expires = "9223372036854775807", // 64-bit CURL_OFF_T_MAX, never expires expires = "9223372036854775807", // 64-bit CURL_OFF_T_MAX, never expires
name = "s", name = "s",
value = cookie
) )
} }