Skip to content

Commit f9d5b66

Browse files
committed
Add clang-tidy wish-list
1 parent 0cc2481 commit f9d5b66

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tidy/README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Things that we want a clang-tidy for
2+
3+
## Closure concept usage
4+
* Templates restricted as Fn are received as const&-ref
5+
* Templates restricted as Fn are invoked as lvalue `f()`
6+
* Templates restricted as FnMut are received by value or as &-ref
7+
* Templates restricted as FnMut are invoked as lvalue `f()`
8+
* Templates restricted as FnOnce are received as &&-ref or by value
9+
* Templates restricted as FnOnce are invoked as rvalue `sus::move(f)()`
10+
11+
## References to closures
12+
* FnOnceRef, FnMutRef and FnRef types only appear as lvalues as ParamVarDecl,
13+
and are not returned.
14+
15+
## Long-lived closures
16+
* Think about how to rewrite FnBox to allow lambdas with capture if we use a
17+
clang-tidy to ensure arguments are not stored as references carelessly.
18+
19+
## Mutable references
20+
* Passing an lvalue to a function receiving an lvalue-reference should require
21+
the argument to be wrapped in `sus::mref()`. Probably exceptions for generic
22+
code.

0 commit comments

Comments
 (0)