Skip to content

Commit

Permalink
Format C++ code with clang-format 18
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Feb 8, 2025
1 parent d33599d commit 2488899
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions include/cxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ class String final {
static String lossy(const char16_t *) noexcept;
static String lossy(const char16_t *, std::size_t) noexcept;

String &operator=(const String &) &noexcept;
String &operator=(String &&) &noexcept;
String &operator=(const String &) & noexcept;
String &operator=(String &&) & noexcept;

explicit operator std::string() const;

Expand Down Expand Up @@ -113,7 +113,7 @@ class Str final {
Str(const char *);
Str(const char *, std::size_t);

Str &operator=(const Str &) &noexcept = default;
Str &operator=(const Str &) & noexcept = default;

explicit operator std::string() const;

Expand Down Expand Up @@ -161,8 +161,8 @@ template <>
struct copy_assignable_if<false> {
copy_assignable_if() noexcept = default;
copy_assignable_if(const copy_assignable_if &) noexcept = default;
copy_assignable_if &operator=(const copy_assignable_if &) &noexcept = delete;
copy_assignable_if &operator=(copy_assignable_if &&) &noexcept = default;
copy_assignable_if &operator=(const copy_assignable_if &) & noexcept = delete;
copy_assignable_if &operator=(copy_assignable_if &&) & noexcept = default;
};
} // namespace detail

Expand All @@ -179,8 +179,8 @@ class Slice final
template <typename C>
explicit Slice(C &c) : Slice(c.data(), c.size()) {}

Slice &operator=(const Slice<T> &) &noexcept = default;
Slice &operator=(Slice<T> &&) &noexcept = default;
Slice &operator=(const Slice<T> &) & noexcept = default;
Slice &operator=(Slice<T> &&) & noexcept = default;

T *data() const noexcept;
std::size_t size() const noexcept;
Expand Down Expand Up @@ -281,7 +281,7 @@ class Box final {
explicit Box(const T &);
explicit Box(T &&);

Box &operator=(Box &&) &noexcept;
Box &operator=(Box &&) & noexcept;

const T *operator->() const noexcept;
const T &operator*() const noexcept;
Expand Down Expand Up @@ -326,7 +326,7 @@ class Vec final {
Vec(Vec &&) noexcept;
~Vec() noexcept;

Vec &operator=(Vec &&) &noexcept;
Vec &operator=(Vec &&) & noexcept;
Vec &operator=(const Vec &) &;

std::size_t size() const noexcept;
Expand Down Expand Up @@ -407,7 +407,7 @@ class Error final : public std::exception {
~Error() noexcept override;

Error &operator=(const Error &) &;
Error &operator=(Error &&) &noexcept;
Error &operator=(Error &&) & noexcept;

const char *what() const noexcept override;

Expand Down Expand Up @@ -779,7 +779,7 @@ Box<T>::~Box() noexcept {
}

template <typename T>
Box<T> &Box<T>::operator=(Box &&other) &noexcept {
Box<T> &Box<T>::operator=(Box &&other) & noexcept {
if (this->ptr) {
this->drop();
}
Expand Down Expand Up @@ -867,7 +867,7 @@ Vec<T>::~Vec() noexcept {
}

template <typename T>
Vec<T> &Vec<T>::operator=(Vec &&other) &noexcept {
Vec<T> &Vec<T>::operator=(Vec &&other) & noexcept {
this->drop();
this->repr = other.repr;
new (&other) Vec();
Expand Down
6 changes: 3 additions & 3 deletions src/cxx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ String String::lossy(const char16_t *s, std::size_t len) noexcept {
return String(lossy_t{}, s, len);
}

String &String::operator=(const String &other) &noexcept {
String &String::operator=(const String &other) & noexcept {
if (this != &other) {
cxxbridge1$string$drop(this);
cxxbridge1$string$clone(this, other);
}
return *this;
}

String &String::operator=(String &&other) &noexcept {
String &String::operator=(String &&other) & noexcept {
cxxbridge1$string$drop(this);
this->repr = other.repr;
cxxbridge1$string$new(&other);
Expand Down Expand Up @@ -487,7 +487,7 @@ Error &Error::operator=(const Error &other) & {
return *this;
}

Error &Error::operator=(Error &&other) &noexcept {
Error &Error::operator=(Error &&other) & noexcept {
std::exception::operator=(std::move(other));
delete[] this->msg;
this->msg = other.msg;
Expand Down

0 comments on commit 2488899

Please sign in to comment.