clippy: us *_or_else with function calls

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2021-01-19 14:04:46 +01:00
parent b92cad0938
commit e062ebbc29
18 changed files with 36 additions and 36 deletions

View File

@ -638,7 +638,7 @@ impl std::str::FromStr for Authid {
.iter()
.rposition(|&b| b == b'!')
.map(|pos| if pos < name_len { id.len() } else { pos })
.unwrap_or(id.len());
.unwrap_or_else(|| id.len());
if realm_end == id.len() - 1 {
bail!("empty token name in userid");
@ -670,7 +670,7 @@ impl TryFrom<String> for Authid {
.iter()
.rposition(|&b| b == b'!')
.map(|pos| if pos < name_len { data.len() } else { pos })
.unwrap_or(data.len());
.unwrap_or_else(|| data.len());
if realm_end == data.len() - 1 {
bail!("empty token name in userid");