From 99a8cbbc110d19128ea7959db924b372f1313923 Mon Sep 17 00:00:00 2001 From: Ted Lyngmo Date: Tue, 10 Sep 2024 14:05:19 +0200 Subject: [PATCH] Fix 2 static analysis warnings reply.h: std::move was used where std::forward should be used Fixes #589 Also made move semantics noexcept in connection_pool Signed-off-by: Ted Lyngmo --- src/sw/redis++/connection_pool.cpp | 4 ++-- src/sw/redis++/connection_pool.h | 4 ++-- src/sw/redis++/reply.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sw/redis++/connection_pool.cpp b/src/sw/redis++/connection_pool.cpp index 41a8f74..25b268e 100644 --- a/src/sw/redis++/connection_pool.cpp +++ b/src/sw/redis++/connection_pool.cpp @@ -55,13 +55,13 @@ ConnectionPool::ConnectionPool(SimpleSentinel sentinel, assert(_sentinel); } -ConnectionPool::ConnectionPool(ConnectionPool &&that) { +ConnectionPool::ConnectionPool(ConnectionPool &&that) noexcept { std::lock_guard lock(that._mutex); _move(std::move(that)); } -ConnectionPool& ConnectionPool::operator=(ConnectionPool &&that) { +ConnectionPool& ConnectionPool::operator=(ConnectionPool &&that) noexcept { if (this != &that) { std::lock(_mutex, that._mutex); std::lock_guard lock_this(_mutex, std::adopt_lock); diff --git a/src/sw/redis++/connection_pool.h b/src/sw/redis++/connection_pool.h index 7872a8a..d81d2d9 100644 --- a/src/sw/redis++/connection_pool.h +++ b/src/sw/redis++/connection_pool.h @@ -55,8 +55,8 @@ class ConnectionPool { ConnectionPool() = default; - ConnectionPool(ConnectionPool &&that); - ConnectionPool& operator=(ConnectionPool &&that); + ConnectionPool(ConnectionPool &&that) noexcept; + ConnectionPool& operator=(ConnectionPool &&that) noexcept; ConnectionPool(const ConnectionPool &) = delete; ConnectionPool& operator=(const ConnectionPool &) = delete; diff --git a/src/sw/redis++/reply.h b/src/sw/redis++/reply.h index c5ba050..f0d5b00 100644 --- a/src/sw/redis++/reply.h +++ b/src/sw/redis++/reply.h @@ -309,7 +309,7 @@ template auto parse_variant(redisReply &reply) -> typename std::enable_if>::type { auto return_var = [](auto &&arg) { - return Variant(std::move(arg)); + return Variant(std::forward(arg)); }; try {