readability-else-after-return

This commit is contained in:
Daniel Chabrowski 2018-02-25 00:24:47 +01:00
parent 9ebb9ff318
commit d5a3bb5234
4 changed files with 11 additions and 17 deletions

View File

@ -328,13 +328,10 @@ inline bool spdlog::details::async_log_helper::process_next_msg(log_clock::time_
// Handle empty queue.. // Handle empty queue..
// This is the only place where the queue can terminate or flush to avoid losing messages already in the queue // This is the only place where the queue can terminate or flush to avoid losing messages already in the queue
else auto now = details::os::now();
{ handle_flush_interval(now, last_flush);
auto now = details::os::now(); sleep_or_yield(now, last_pop);
handle_flush_interval(now, last_flush); return !_terminate_requested;
sleep_or_yield(now, last_pop);
return !_terminate_requested;
}
} }
// flush all sinks if _flush_interval_ms has expired // flush all sinks if _flush_interval_ms has expired

View File

@ -403,10 +403,7 @@ inline std::string errno_to_string(char buf[256], int res)
{ {
return std::string(buf); return std::string(buf);
} }
else return "Unknown error";
{
return "Unknown error";
}
} }
// Return errno string (thread safe) // Return errno string (thread safe)

View File

@ -662,10 +662,10 @@ inline void spdlog::pattern_formatter::handle_flag(char flag)
inline std::tm spdlog::pattern_formatter::get_time(details::log_msg& msg) inline std::tm spdlog::pattern_formatter::get_time(details::log_msg& msg)
{ {
if (_pattern_time == pattern_time_type::local) if (_pattern_time == pattern_time_type::local) {
return details::os::localtime(log_clock::to_time_t(msg.time)); return details::os::localtime(log_clock::to_time_t(msg.time));
else }
return details::os::gmtime(log_clock::to_time_t(msg.time)); return details::os::gmtime(log_clock::to_time_t(msg.time));
} }
inline void spdlog::pattern_formatter::format(details::log_msg& msg) inline void spdlog::pattern_formatter::format(details::log_msg& msg)

View File

@ -236,10 +236,10 @@ private:
date.tm_min = _rotation_m; date.tm_min = _rotation_m;
date.tm_sec = 0; date.tm_sec = 0;
auto rotation_time = std::chrono::system_clock::from_time_t(std::mktime(&date)); auto rotation_time = std::chrono::system_clock::from_time_t(std::mktime(&date));
if (rotation_time > now) if (rotation_time > now) {
return rotation_time; return rotation_time;
else }
return std::chrono::system_clock::time_point(rotation_time + std::chrono::hours(24)); return std::chrono::system_clock::time_point(rotation_time + std::chrono::hours(24));
} }
filename_t _base_filename; filename_t _base_filename;