AlwaysBreakTemplateDeclarations: true

I felt that the clangfmt changes in c2279000a9
were not making the code better.
This commit is contained in:
David Tolnay 2020-04-11 22:12:40 -07:00
parent c2279000a9
commit f262d38671
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
3 changed files with 15 additions and 7 deletions

1
.clang-format Normal file
View File

@ -0,0 +1 @@
AlwaysBreakTemplateDeclarations: true

View File

@ -85,7 +85,8 @@ private:
#ifndef CXXBRIDGE02_RUST_BOX
#define CXXBRIDGE02_RUST_BOX
template <typename T> class Box final {
template <typename T>
class Box final {
public:
using value_type = T;
using const_pointer = typename std::add_pointer<
@ -132,7 +133,8 @@ public:
T *operator->() noexcept { return this->ptr; }
T &operator*() noexcept { return *this->ptr; }
template <typename... Fields> static Box in_place(Fields &&... fields) {
template <typename... Fields>
static Box in_place(Fields &&... fields) {
Box box;
box.uninit();
::new (box.ptr) T{std::forward<Fields>(fields)...};
@ -163,7 +165,8 @@ private:
#ifndef CXXBRIDGE02_RUST_FN
#define CXXBRIDGE02_RUST_FN
template <typename Signature, bool Throws = false> class Fn;
template <typename Signature, bool Throws = false>
class Fn;
template <typename Ret, typename... Args, bool Throws>
class Fn<Ret(Args...), Throws> {
@ -176,7 +179,8 @@ private:
void *fn;
};
template <typename Signature> using TryFn = Fn<Signature, true>;
template <typename Signature>
using TryFn = Fn<Signature, true>;
#endif // CXXBRIDGE02_RUST_FN
#ifndef CXXBRIDGE02_RUST_ERROR
@ -209,11 +213,13 @@ std::ostream &operator<<(std::ostream &, const Str &);
// Snake case aliases for use in code that uses this style for type names.
using string = String;
using str = Str;
template <class T> using box = Box<T>;
template <class T>
using box = Box<T>;
using error = Error;
template <typename Signature, bool Throws = false>
using fn = Fn<Signature, Throws>;
template <typename Signature> using try_fn = TryFn<Signature>;
template <typename Signature>
using try_fn = TryFn<Signature>;
#ifndef CXXBRIDGE02_RUST_BITCOPY
#define CXXBRIDGE02_RUST_BITCOPY

View File

@ -5,7 +5,8 @@
#include <memory>
#include <stdexcept>
template <typename Exception> static void panic [[noreturn]] (const char *msg) {
template <typename Exception>
static void panic [[noreturn]] (const char *msg) {
#if defined(RUST_CXX_NO_EXCEPTIONS)
std::cerr << "Error: " << msg << ". Aborting." << std::endl;
std::terminate();