AlwaysBreakTemplateDeclarations: true
I felt that the clangfmt changes in c2279000a926db64c0bb0caa69025031174d576a
were not making the code better.
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..181605d
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1 @@
+AlwaysBreakTemplateDeclarations: true
diff --git a/include/cxx.h b/include/cxx.h
index f7decd8..a8239a1 100644
--- a/include/cxx.h
+++ b/include/cxx.h
@@ -85,7 +85,8 @@
#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 @@
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 @@
#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 @@
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 @@
// 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
diff --git a/src/cxx.cc b/src/cxx.cc
index e8ec979..b64333c 100644
--- a/src/cxx.cc
+++ b/src/cxx.cc
@@ -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();