mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
pvattest: Use map_or and map_or_else
Replace 'match .. { Some(v) => y, None/_ => x }' statements with
'Option::map_or_else' and 'Option::map_or'. See
https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else.
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
b1ca60f5ba
commit
6c75a06b12
@@ -56,10 +56,9 @@ impl Display for Response {
|
||||
if self.valid { "" } else { "not " }
|
||||
)?;
|
||||
|
||||
match &self.reason {
|
||||
Some(r) => write!(f, "\n Reason: {r}\n ReferenceId: {}", self.reference_id),
|
||||
None => Ok(()),
|
||||
}
|
||||
self.reason.as_ref().map_or(Ok(()), |r| {
|
||||
write!(f, "\n Reason: {r}\n ReferenceId: {}", self.reference_id)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user