Skip to content

Commit

Permalink
fix: clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
fukua95 committed Dec 6, 2024
1 parent 27b8738 commit 4fc07cc
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/cluster/sync_migrate_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class SyncMigrateContext : private EvbufCallbackBase<SyncMigrateContext, false>,
private EventCallbackBase<SyncMigrateContext> {
public:
SyncMigrateContext(Server *srv, redis::Connection *conn, int timeout) : srv_(srv), conn_(conn), timeout_(timeout){};
SyncMigrateContext(Server *srv, redis::Connection *conn, int timeout) : srv_(srv), conn_(conn), timeout_(timeout) {};

void Suspend();
void Resume(const Status &migrate_result);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/command_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

template <typename Iter>
struct MoveIterator : Iter {
explicit MoveIterator(Iter iter) : Iter(iter){};
explicit MoveIterator(Iter iter) : Iter(iter) {};

typename Iter::value_type&& operator*() const { return std::move(this->Iter::operator*()); }
};
Expand Down
5 changes: 1 addition & 4 deletions src/commands/commander.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,7 @@ StatusOr<std::vector<int>> CommandTable::GetKeysFromCommand(const CommandAttribu
[&](const std::vector<std::string> &, CommandKeyRange key_range) {
key_range.ForEachKeyIndex([&](int i) { key_indexes.push_back(i); }, cmd_tokens.size());
},
cmd_tokens,
[&](const auto &) {
status = {Status::NotOK, "The command has no key arguments"};
});
cmd_tokens, [&](const auto &) { status = {Status::NotOK, "The command has no key arguments"}; });

if (!status) {
return status;
Expand Down
2 changes: 1 addition & 1 deletion src/common/cron.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct CronPattern {

struct Interval {
int interval;
}; // */n
}; // */n
struct Any {}; // *
using Numbers = std::vector<std::variant<Number, Range>>; // 1,2,3-6,7

Expand Down
4 changes: 2 additions & 2 deletions src/common/rdb_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class RdbStream {

class RdbStringStream : public RdbStream {
public:
explicit RdbStringStream(std::string_view input) : input_(input){};
explicit RdbStringStream(std::string_view input) : input_(input) {};
RdbStringStream(const RdbStringStream &) = delete;
RdbStringStream &operator=(const RdbStringStream &) = delete;
~RdbStringStream() override = default;
Expand All @@ -65,7 +65,7 @@ class RdbStringStream : public RdbStream {
class RdbFileStream : public RdbStream {
public:
explicit RdbFileStream(std::string file_name, size_t chunk_size = 1024 * 1024)
: file_name_(std::move(file_name)), check_sum_(0), total_read_bytes_(0), max_read_chunk_size_(chunk_size){};
: file_name_(std::move(file_name)), check_sum_(0), total_read_bytes_(0), max_read_chunk_size_(chunk_size) {};
RdbFileStream(const RdbFileStream &) = delete;
RdbFileStream &operator=(const RdbFileStream &) = delete;
~RdbFileStream() override = default;
Expand Down
2 changes: 1 addition & 1 deletion src/common/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ struct StringInStatusOr<T, std::enable_if_t<sizeof(T) < sizeof(std::string)>> :
StringInStatusOr(StringInStatusOr<U>&& v) : BaseType(new std::string(*std::move(v))) {} // NOLINT
template <typename U, typename std::enable_if_t<!StringInStatusOr<U>::inplace, int> = 0>
StringInStatusOr(StringInStatusOr<U>&& v) // NOLINT
: BaseType((typename StringInStatusOr<U>::BaseType &&)(std::move(v))) {}
: BaseType((typename StringInStatusOr<U>::BaseType&&)(std::move(v))) {}

StringInStatusOr(const StringInStatusOr& v) = delete;

Expand Down
3 changes: 1 addition & 2 deletions src/search/interval.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ struct IntervalSet {

std::string ToString() const {
if (IsEmpty()) return "empty set";
return util::StringJoin(
intervals, [](const auto &i) { return Interval(i.first, i.second).ToString(); }, " or ");
return util::StringJoin(intervals, [](const auto &i) { return Interval(i.first, i.second).ToString(); }, " or ");
}

friend std::ostream &operator<<(std::ostream &os, const IntervalSet &is) { return os << is.ToString(); }
Expand Down
2 changes: 1 addition & 1 deletion src/search/ir.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ struct NumericCompareExpr : BoolAtomExpr {
struct VectorLiteral : Literal {
std::vector<double> values;

explicit VectorLiteral(std::vector<double> &&values) : values(std::move(values)){};
explicit VectorLiteral(std::vector<double> &&values) : values(std::move(values)) {};

std::string_view Name() const override { return "VectorLiteral"; }
std::string Dump() const override {
Expand Down
3 changes: 1 addition & 2 deletions src/search/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ struct Value : std::variant<Null, Numeric, String, StringArray, NumericArray> {
} else if (Is<String>()) {
return Get<String>();
} else if (Is<StringArray>()) {
return util::StringJoin(
Get<StringArray>(), [](const auto &v) -> decltype(auto) { return v; }, sep);
return util::StringJoin(Get<StringArray>(), [](const auto &v) -> decltype(auto) { return v; }, sep);
} else if (Is<NumericArray>()) {
return util::StringJoin(
Get<NumericArray>(), [](const auto &v) -> decltype(auto) { return std::to_string(v); }, sep);
Expand Down
4 changes: 2 additions & 2 deletions src/storage/iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ class WALBatchExtractor : public rocksdb::WriteBatch::Handler {
class WALIterator {
public:
explicit WALIterator(engine::Storage *storage, const SlotRange &slot_range)
: storage_(storage), slot_range_(slot_range), extractor_(slot_range), next_batch_seq_(0){};
: storage_(storage), slot_range_(slot_range), extractor_(slot_range), next_batch_seq_(0) {};
explicit WALIterator(engine::Storage *storage, int slot = -1)
: storage_(storage), slot_range_(slot, slot), extractor_(slot), next_batch_seq_(0){};
: storage_(storage), slot_range_(slot, slot), extractor_(slot), next_batch_seq_(0) {};
~WALIterator() = default;

bool Valid() const;
Expand Down
2 changes: 1 addition & 1 deletion src/storage/rdb/rdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ using RedisObjValue =
class RDB {
public:
explicit RDB(engine::Storage *storage, std::string ns, std::unique_ptr<RdbStream> stream)
: storage_(storage), ns_(std::move(ns)), stream_(std::move(stream)){};
: storage_(storage), ns_(std::move(ns)), stream_(std::move(stream)) {};
~RDB() = default;

Status VerifyPayloadChecksum(const std::string_view &payload);
Expand Down
2 changes: 1 addition & 1 deletion src/storage/rdb/rdb_intset.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class IntSet {
public:
explicit IntSet(std::string_view input) : input_(input){};
explicit IntSet(std::string_view input) : input_(input) {};
~IntSet() = default;
StatusOr<std::vector<std::string>> Entries();

Expand Down
2 changes: 1 addition & 1 deletion src/storage/rdb/rdb_listpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class ListPack {
public:
explicit ListPack(std::string_view input) : input_(input){};
explicit ListPack(std::string_view input) : input_(input) {};
~ListPack() = default;

StatusOr<uint32_t> Length();
Expand Down
2 changes: 1 addition & 1 deletion src/storage/rdb/rdb_ziplist.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ constexpr const uint8_t zlEnd = 0xFF;

class ZipList {
public:
explicit ZipList(std::string_view input) : input_(input){};
explicit ZipList(std::string_view input) : input_(input) {};
~ZipList() = default;

StatusOr<std::string> Next();
Expand Down
2 changes: 1 addition & 1 deletion src/storage/rdb/rdb_zipmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

class ZipMap {
public:
explicit ZipMap(std::string_view input) : input_(input){};
explicit ZipMap(std::string_view input) : input_(input) {};
~ZipMap() = default;

StatusOr<std::pair<std::string, std::string>> Next();
Expand Down
2 changes: 1 addition & 1 deletion src/types/bloom_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ StatusOr<BlockSplitBloomFilter> CreateBlockSplitBloomFilter(std::string& bitset)
class BlockSplitBloomFilter {
public:
/// The constructor of BlockSplitBloomFilter. It uses XXH64 as hash function.
explicit BlockSplitBloomFilter(nonstd::span<char> data) : data_(data){};
explicit BlockSplitBloomFilter(nonstd::span<char> data) : data_(data) {};

/// Calculate optimal size according to the number of distinct values and false
/// positive probability.
Expand Down
2 changes: 1 addition & 1 deletion src/types/redis_stream_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class AutoGeneratedEntryID : public NextStreamEntryIDGenerationStrategy {

class SpecificTimestampWithAnySequenceNumber : public NextStreamEntryIDGenerationStrategy {
public:
explicit SpecificTimestampWithAnySequenceNumber(uint64_t ms) : ms_(ms){};
explicit SpecificTimestampWithAnySequenceNumber(uint64_t ms) : ms_(ms) {};
~SpecificTimestampWithAnySequenceNumber() override = default;

Status GenerateID(const StreamEntryID &last_id, StreamEntryID *next_id) override;
Expand Down

0 comments on commit 4fc07cc

Please sign in to comment.