Skip to content

Possible unintented formatting styles #11

@nkaralis

Description

@nkaralis

I have compiled a list of formatting styles that we might not want to follow.

A:

template<typename T, typename U>
concept DummyConcept
    =  Dummy1<T>
    && Dummy1<U>
    && Expr1 == Expr2
    && Expr3 == Expr4

is formatted to a single line

@bigerl: this can probably be prevented with an // at the end of each line. Is it still wrapped if lines get too long?

B:

static_assert(Expr1
              && Expr 2)

is formatted to a single line

@bigerl: same as A

C:

template<typename T> requires Dummy1<T> or Dummy2<T>

is formatted to multiple lines. I do not think that it is an issue, but I wanted to double check if it intended

@bigerl: how does it look then?

D:

std::variant<Type1,
             Type2,
             Type3> data;

`data` is pushed to a new line.

@bigerl: I think that should not happen.

E:

{ T::func(arg1, arg2) } -> Type;

in concepts, such definitions are formatted to multiple lines (example below)
{ 
    T::func(arg1, arg2)
    } -> Type;

@bigerl: I think that should not happen but I am afraid that clang-format might not allow us to configure that.

F:

if {
    ...
}
// comment
else {

}

the brace next to `else` is pushed to a new line

@bigerl: I would suggest to put the comment to the bracket like: } else { // comment

G:

auto val = []() -> auto {
    ...
}();
the parenthesis `()` for calling the lambda are pushed to a new line

@bigerl: I think that should not happen

H:

DICE_DEFER { tentris_solution_generator_free(q); };

is formatted to multiple lines

@bigerl: I think that should not happen but here I am also not sure if we can prevent clang-format to do that.

H:

function_call(
    "..."
    "..."
).another_function_call();

.anothert_function_call is pushed to a new line

@bigerl: I think that should not happen.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions