Commit 17d469e2 authored by Robert Czechowski's avatar Robert Czechowski

Replace some occurences of and_then() by map() as suggest by clippy lint...

Replace some occurences of and_then() by map() as suggest by clippy lint clippy::bind-instead-of-map
parent 667f88aa
Pipeline #729 passed with stages
in 20 minutes and 39 seconds
......@@ -42,9 +42,8 @@ impl MedalObject<Connection> for Task {
AND location = $2";
conn.query_map_one(query, &[&self.taskgroup, &self.location], |row| row.get(0))
.unwrap_or(None)
.and_then(|id| {
.map(|id| {
self.set_id(id);
Some(())
})
.unwrap_or(()); // Err means no entry yet and is expected result
......@@ -78,9 +77,8 @@ impl MedalObject<Connection> for Taskgroup {
AND task.location = $2";
conn.query_map_one(query, &[&self.contest, &first_task.location], |row| row.get(0))
.unwrap_or(None)
.and_then(|id| {
.map(|id| {
self.set_id(id);
Some(())
})
.unwrap_or(()); // Err means no entry yet and is expected result
}
......@@ -116,9 +114,8 @@ impl MedalObject<Connection> for Contest {
AND filename = $2";
conn.query_map_one(query, &[&self.location, &self.filename], |row| row.get(0))
.unwrap_or(None)
.and_then(|id| {
.map(|id| {
self.set_id(id);
Some(())
})
.unwrap_or(()); // Err means no entry yet and is expected result
......
......@@ -154,9 +154,8 @@ impl MedalObject<Connection> for Task {
AND location = $2";
conn.query_map_one(query, &[&self.taskgroup, &self.location], |row| row.get(0))
.unwrap_or(None)
.and_then(|id| {
.map(|id| {
self.set_id(id);
Some(())
})
.unwrap_or(()); // Err means no entry yet and is expected result
......@@ -190,9 +189,8 @@ impl MedalObject<Connection> for Taskgroup {
AND task.location = $2";
conn.query_map_one(query, &[&self.contest, &first_task.location], |row| row.get(0))
.unwrap_or(None)
.and_then(|id| {
.map(|id| {
self.set_id(id);
Some(())
})
.unwrap_or(()); // Err means no entry yet and is expected result
}
......@@ -228,9 +226,8 @@ impl MedalObject<Connection> for Contest {
AND filename = $2";
conn.query_map_one(query, &[&self.location, &self.filename], |row| row.get(0))
.unwrap_or(None)
.and_then(|id| {
.map(|id| {
self.set_id(id);
Some(())
})
.unwrap_or(()); // Err means no entry yet and is expected result
......
......@@ -154,9 +154,8 @@ impl MedalObject<Connection> for Task {
AND location = ?2";
conn.query_map_one(query, &[&self.taskgroup, &self.location], |row| row.get(0))
.unwrap_or(None)
.and_then(|id| {
.map(|id| {
self.set_id(id);
Some(())
})
.unwrap_or(()); // Err means no entry yet and is expected result
......@@ -190,9 +189,8 @@ impl MedalObject<Connection> for Taskgroup {
AND task.location = ?2";
conn.query_map_one(query, &[&self.contest, &first_task.location], |row| row.get(0))
.unwrap_or(None)
.and_then(|id| {
.map(|id| {
self.set_id(id);
Some(())
})
.unwrap_or(()); // Err means no entry yet and is expected result
}
......@@ -228,9 +226,8 @@ impl MedalObject<Connection> for Contest {
AND filename = ?2";
conn.query_map_one(query, &[&self.location, &self.filename], |row| row.get(0))
.unwrap_or(None)
.and_then(|id| {
.map(|id| {
self.set_id(id);
Some(())
})
.unwrap_or(()); // Err means no entry yet and is expected result
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment