mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
Simplify unset_empty()
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
//! # Login parameters.
|
//! # Login parameters.
|
||||||
|
|
||||||
use std::borrow::Cow;
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use anyhow::{ensure, Result};
|
use anyhow::{ensure, Result};
|
||||||
@@ -298,12 +297,11 @@ impl fmt::Display for LoginParam {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::ptr_arg)]
|
fn unset_empty(s: &str) -> &str {
|
||||||
fn unset_empty(s: &String) -> Cow<String> {
|
|
||||||
if s.is_empty() {
|
if s.is_empty() {
|
||||||
Cow::Owned("unset".to_string())
|
"unset"
|
||||||
} else {
|
} else {
|
||||||
Cow::Borrowed(s)
|
s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user