[librsvg: 4/13] Express `Result.and_then(|x| Ok(y))` as `map(|x| y)`
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 4/13] Express `Result.and_then(|x| Ok(y))` as `map(|x| y)`
- Date: Wed, 26 Aug 2020 17:30:41 +0000 (UTC)
commit 4ff35fcafe33704ce4838eddfccb350f21e82463
Author: Sven Neumann <sven svenfoo org>
Date: Tue Aug 25 15:26:05 2020 +0200
Express `Result.and_then(|x| Ok(y))` as `map(|x| y)`
See https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
librsvg/c_api.rs | 6 +++---
librsvg/pixbuf_utils.rs | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/librsvg/c_api.rs b/librsvg/c_api.rs
index 2923c351..97428e11 100644
--- a/librsvg/c_api.rs
+++ b/librsvg/c_api.rs
@@ -817,15 +817,15 @@ impl CHandle {
Ok((ink_r, width, height))
})
- .and_then(|(ink_r, width, height)| {
+ .map(|(ink_r, width, height)| {
let (w, h) = inner.size_callback.call(width, height);
- Ok(RsvgDimensionData {
+ RsvgDimensionData {
width: w,
height: h,
em: ink_r.width(),
ex: ink_r.height(),
- })
+ }
});
inner.size_callback.end_loop();
diff --git a/librsvg/pixbuf_utils.rs b/librsvg/pixbuf_utils.rs
index 057dbee0..adeaf825 100644
--- a/librsvg/pixbuf_utils.rs
+++ b/librsvg/pixbuf_utils.rs
@@ -260,7 +260,7 @@ fn pixbuf_from_file_with_size_mode(
dpi,
)
})
- .and_then(|pixbuf| Ok(pixbuf.to_glib_full()))
+ .map(|pixbuf| pixbuf.to_glib_full())
.unwrap_or_else(|e| {
set_gerror(error, 0, &format!("{}", e));
ptr::null_mut()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]