Skip to content

Commit ceae0e3

Browse files
oppmscandit-opmbaylesj
authored
Fix clang-tidy warnings (#1231)
* Fix clang-tidy warnings Signed-off-by: Marcel Opprecht <[email protected]> * Fixup/clang-format Co-authored-by: Marcel Opprecht <[email protected]> Co-authored-by: Jordan Bayles <[email protected]>
1 parent 30170d6 commit ceae0e3

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
lines changed

CONTRIBUTING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ bool Reader::decodeNumber(Token& token) {
143143
```
144144
145145
Before submitting your code, ensure that you meet the versioning requirements above, follow the style guide of the file you are modifying (or the above rules for new files), and run clang format. Meson exposes clang format with the following command:
146-
147146
```
148147
ninja -v -C build-${LIB_TYPE}/ clang-format
149148
```
149+
150+
For convenience, you can also run the `reformat.sh` script located in the root directory.
151+

include/json/value.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,10 @@ class JSON_API Value {
263263
CZString(ArrayIndex index);
264264
CZString(char const* str, unsigned length, DuplicationPolicy allocate);
265265
CZString(CZString const& other);
266-
CZString(CZString&& other);
266+
CZString(CZString&& other) noexcept;
267267
~CZString();
268268
CZString& operator=(const CZString& other);
269-
CZString& operator=(CZString&& other);
269+
CZString& operator=(CZString&& other) noexcept;
270270

271271
bool operator<(CZString const& other) const;
272272
bool operator==(CZString const& other) const;
@@ -344,13 +344,13 @@ class JSON_API Value {
344344
Value(bool value);
345345
Value(std::nullptr_t ptr) = delete;
346346
Value(const Value& other);
347-
Value(Value&& other);
347+
Value(Value&& other) noexcept;
348348
~Value();
349349

350350
/// \note Overwrite existing comments. To preserve comments, use
351351
/// #swapPayload().
352352
Value& operator=(const Value& other);
353-
Value& operator=(Value&& other);
353+
Value& operator=(Value&& other) noexcept;
354354

355355
/// Swap everything.
356356
void swap(Value& other);
@@ -635,9 +635,9 @@ class JSON_API Value {
635635
public:
636636
Comments() = default;
637637
Comments(const Comments& that);
638-
Comments(Comments&& that);
638+
Comments(Comments&& that) noexcept;
639639
Comments& operator=(const Comments& that);
640-
Comments& operator=(Comments&& that);
640+
Comments& operator=(Comments&& that) noexcept;
641641
bool has(CommentPlacement slot) const;
642642
String get(CommentPlacement slot) const;
643643
void set(CommentPlacement slot, String comment);

reformat.sh

100644100755
File mode changed.

src/lib_json/json_reader.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,7 @@ bool CharReaderBuilder::validate(Json::Value* invalid) const {
19211921
if (valid_keys.count(key))
19221922
continue;
19231923
if (invalid)
1924-
(*invalid)[std::move(key)] = *si;
1924+
(*invalid)[key] = *si;
19251925
else
19261926
return false;
19271927
}

src/lib_json/json_value.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ Value::CZString::CZString(const CZString& other) {
259259
storage_.length_ = other.storage_.length_;
260260
}
261261

262-
Value::CZString::CZString(CZString&& other)
262+
Value::CZString::CZString(CZString&& other) noexcept
263263
: cstr_(other.cstr_), index_(other.index_) {
264264
other.cstr_ = nullptr;
265265
}
@@ -285,7 +285,7 @@ Value::CZString& Value::CZString::operator=(const CZString& other) {
285285
return *this;
286286
}
287287

288-
Value::CZString& Value::CZString::operator=(CZString&& other) {
288+
Value::CZString& Value::CZString::operator=(CZString&& other) noexcept {
289289
cstr_ = other.cstr_;
290290
index_ = other.index_;
291291
other.cstr_ = nullptr;
@@ -433,7 +433,7 @@ Value::Value(const Value& other) {
433433
dupMeta(other);
434434
}
435435

436-
Value::Value(Value&& other) {
436+
Value::Value(Value&& other) noexcept {
437437
initBasic(nullValue);
438438
swap(other);
439439
}
@@ -448,7 +448,7 @@ Value& Value::operator=(const Value& other) {
448448
return *this;
449449
}
450450

451-
Value& Value::operator=(Value&& other) {
451+
Value& Value::operator=(Value&& other) noexcept {
452452
other.swap(*this);
453453
return *this;
454454
}
@@ -1373,14 +1373,15 @@ bool Value::isObject() const { return type() == objectValue; }
13731373
Value::Comments::Comments(const Comments& that)
13741374
: ptr_{cloneUnique(that.ptr_)} {}
13751375

1376-
Value::Comments::Comments(Comments&& that) : ptr_{std::move(that.ptr_)} {}
1376+
Value::Comments::Comments(Comments&& that) noexcept
1377+
: ptr_{std::move(that.ptr_)} {}
13771378

13781379
Value::Comments& Value::Comments::operator=(const Comments& that) {
13791380
ptr_ = cloneUnique(that.ptr_);
13801381
return *this;
13811382
}
13821383

1383-
Value::Comments& Value::Comments::operator=(Comments&& that) {
1384+
Value::Comments& Value::Comments::operator=(Comments&& that) noexcept {
13841385
ptr_ = std::move(that.ptr_);
13851386
return *this;
13861387
}

src/lib_json/json_writer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ bool StreamWriterBuilder::validate(Json::Value* invalid) const {
12171217
if (valid_keys.count(key))
12181218
continue;
12191219
if (invalid)
1220-
(*invalid)[std::move(key)] = *si;
1220+
(*invalid)[key] = *si;
12211221
else
12221222
return false;
12231223
}

0 commit comments

Comments
 (0)