Skip to content

Commit 252dd02

Browse files
committed
tools: Update tidy.sh and related configs/markers
1 parent 1577b59 commit 252dd02

File tree

5 files changed

+434
-208
lines changed

5 files changed

+434
-208
lines changed

.cspell.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,25 @@
2727
"ignoreRegExpList": [
2828
// Copyright notice
2929
"Copyright .*",
30+
"SPDX-(File|Snippet)CopyrightText: .*",
3031
// GHA actions/workflows
31-
"uses: .+@",
32+
"uses: .+@[\\w_.-]+",
3233
// GHA context (repo name, owner name, etc.)
33-
"github.\\w+ (=|!)= '.+'",
34+
"github.[\\w_.-]+ (=|!)= '[^']+'",
3435
// GH username
3536
"( |\\[)@[\\w_-]+",
3637
// Git config username
37-
"git config user.name .*",
38-
// Username in todo comment
38+
"git config( --[^ ]+)? user.name .*",
39+
// Username in TODO|FIXME comment
3940
"(TODO|FIXME)\\([\\w_., -]+\\)",
4041
// Cargo.toml authors
41-
"authors *= *\\[.*\\]",
42-
"\".* <[\\w_.+-]+@[\\w.-]+>\""
42+
"authors *= *\\[[^\\]]*\\]",
43+
"\"[^\"]* <[\\w_.+-]+@[\\w.-]+>\""
4344
],
4445
"languageSettings": [
4546
{
4647
"languageId": ["*"],
47-
"dictionaries": ["bash", "rust"]
48+
"dictionaries": ["bash", "cpp-refined", "rust"]
4849
}
4950
],
5051
"ignorePaths": []

.editorconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ indent_style = space
1111
insert_final_newline = true
1212
trim_trailing_whitespace = true
1313

14-
[*.{json,md,rb,sh,yml,yaml}]
14+
[*.{css,html,json,md,rb,sh,yml,yaml}]
1515
indent_size = 2
1616

1717
[*.{js,yml,yaml}]
1818
quote_type = single
1919

2020
[*.sh]
21+
# https://google.github.io/styleguide/shellguide.html#s5.3-pipelines
2122
binary_next_line = true
23+
# https://google.github.io/styleguide/shellguide.html#s5.5-case-statement
2224
switch_case_indent = true

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[![msrv](https://img.shields.io/badge/msrv-1.31-blue?style=flat-square&logo=rust)](https://www.rust-lang.org)
77
[![github actions](https://img.shields.io/github/actions/workflow/status/taiki-e/easy-ext/ci.yml?branch=main&style=flat-square&logo=github)](https://github.com/taiki-e/easy-ext/actions)
88

9-
<!-- tidy:crate-doc:start -->
9+
<!-- tidy:sync-markdown-to-rustdoc:start:src/lib.rs -->
10+
1011
A lightweight attribute macro for easily writing [extension trait pattern][rfc0445].
1112

1213
```toml
@@ -176,7 +177,7 @@ impl str {
176177

177178
[rfc0445]: https://github.com/rust-lang/rfcs/blob/HEAD/text/0445-extension-trait-conventions.md
178179

179-
<!-- tidy:crate-doc:end -->
180+
<!-- tidy:sync-markdown-to-rustdoc:end -->
180181

181182
## License
182183

src/lib.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// SPDX-License-Identifier: Apache-2.0 OR MIT
22

33
/*!
4-
<!-- tidy:crate-doc:start -->
4+
<!-- Note: Document from sync-markdown-to-rustdoc:start through sync-markdown-to-rustdoc:end
5+
is synchronized from README.md. Any changes to that range are not preserved. -->
6+
<!-- tidy:sync-markdown-to-rustdoc:start -->
7+
58
A lightweight attribute macro for easily writing [extension trait pattern][rfc0445].
69
710
```toml
@@ -11,7 +14,7 @@ easy-ext = "1"
1114
1215
## Examples
1316
14-
```rust
17+
```
1518
use easy_ext::ext;
1619
1720
#[ext(ResultExt)]
@@ -27,7 +30,7 @@ pub impl<T, E> Result<T, E> {
2730
2831
Code like this will be generated:
2932
30-
```rust
33+
```
3134
pub trait ResultExt<T, E> {
3235
fn err_into<U>(self) -> Result<T, U>
3336
where
@@ -46,7 +49,7 @@ impl<T, E> ResultExt<T, E> for Result<T, E> {
4649
4750
You can elide the trait name.
4851
49-
```rust
52+
```
5053
use easy_ext::ext;
5154
5255
#[ext]
@@ -71,7 +74,7 @@ There are two ways to specify visibility.
7174
7275
The first way is to specify visibility at the impl level. For example:
7376
74-
```rust
77+
```
7578
use easy_ext::ext;
7679
7780
// unnamed
@@ -93,7 +96,7 @@ Another way is to specify visibility at the associated item level.
9396
9497
For example, if the method is `pub` then the trait will also be `pub`:
9598
96-
```rust
99+
```
97100
use easy_ext::ext;
98101
99102
#[ext(ResultExt)] // generate `pub trait ResultExt`
@@ -118,7 +121,7 @@ Note that you cannot specify impl-level visibility and associated-item-level vis
118121
If you want the extension trait to be a subtrait of another trait,
119122
add `Self: SubTrait` bound to the `where` clause.
120123
121-
```rust
124+
```
122125
use easy_ext::ext;
123126
124127
#[ext(Ext)]
@@ -134,7 +137,7 @@ where
134137
135138
#### [Associated functions (methods)](https://doc.rust-lang.org/reference/items/associated-items.html#associated-functions-and-methods)
136139
137-
```rust
140+
```
138141
use easy_ext::ext;
139142
140143
#[ext]
@@ -145,7 +148,7 @@ impl<T> T {
145148
146149
#### [Associated constants](https://doc.rust-lang.org/reference/items/associated-items.html#associated-constants)
147150
148-
```rust
151+
```
149152
use easy_ext::ext;
150153
151154
#[ext]
@@ -156,7 +159,7 @@ impl<T> T {
156159
157160
#### [Associated types](https://doc.rust-lang.org/reference/items/associated-items.html#associated-types)
158161
159-
```rust
162+
```
160163
use easy_ext::ext;
161164
162165
#[ext]
@@ -171,7 +174,7 @@ impl str {
171174
172175
[rfc0445]: https://github.com/rust-lang/rfcs/blob/HEAD/text/0445-extension-trait-conventions.md
173176
174-
<!-- tidy:crate-doc:end -->
177+
<!-- tidy:sync-markdown-to-rustdoc:end -->
175178
*/
176179

177180
#![doc(test(

0 commit comments

Comments
 (0)