Skip to content

Commit

Permalink
Fix: Never type fallback change (#1699)
Browse files Browse the repository at this point in the history
Never type (!) to any type (`never-to-any`) coercions fall back to never type (!) rather than to unit type (()).
  • Loading branch information
jjnicola authored Aug 15, 2024
1 parent 9f44e07 commit 159eb75
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rust/feed-verifier/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn get(con: &mut redis::Connection) -> RedisResult<HashMap<String, Vec<String>>>
redis::Cmd::new()
.arg("SELECT")
.arg(i.to_string())
.query(con)?;
.query::<()>(con)?;
let result = get_all(con)?;
if result.len() > 1 {
return Ok(result);
Expand Down
9 changes: 5 additions & 4 deletions rust/redis-storage/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,15 +621,15 @@ impl RedisCtx {
.cmd("SELECT")
.arg(self.db)
.ignore()
.query(&mut self.kb.as_mut().expect("Valid redis connection"))?;
.query::<()>(&mut self.kb.as_mut().expect("Valid redis connection"))?;
Ok(())
}

/// Delete all keys in the namespace and release the it
pub fn delete_namespace(&mut self) -> RedisStorageResult<()> {
Cmd::new()
.arg("FLUSHDB")
.query(&mut self.kb.as_mut().expect("Valid redis connection"))?;
.query::<()>(&mut self.kb.as_mut().expect("Valid redis connection"))?;
self.release_namespace()?;
Ok(())
}
Expand All @@ -638,13 +638,14 @@ impl RedisCtx {
pub fn flush_namespace(&mut self) -> RedisStorageResult<()> {
Cmd::new()
.arg("FLUSHDB")
.query(&mut self.kb.as_mut().expect("Valid redis connection"))?;
.query::<()>(&mut self.kb.as_mut().expect("Valid redis connection"))?;
Ok(())
}

//Wrapper function to avoid accessing kb member directly.
pub fn set_value<T: ToRedisArgs>(&mut self, key: &str, val: T) -> RedisStorageResult<()> {
self.kb
() = self
.kb
.as_mut()
.expect("Valid redis connection")
.set(key, val)?;
Expand Down

0 comments on commit 159eb75

Please sign in to comment.