@@ -24,7 +24,7 @@ because that's clearly a non-descriptive name.
24
24
- [ Lint passes] ( #lint-passes )
25
25
- [ Emitting a lint] ( #emitting-a-lint )
26
26
- [ Adding the lint logic] ( #adding-the-lint-logic )
27
- - [ Specifying the lint's minimum supported Rust version (MSRV)] ( #specifying-the-lints-minimum-supported-rust-version-msrv )
27
+ - [ Specifying the lint's minimum supported Rust version (MSRV)] ( #specifying-the-lints-minimum-supported-rust-version-- msrv- )
28
28
- [ Author lint] ( #author-lint )
29
29
- [ Print HIR lint] ( #print-hir-lint )
30
30
- [ Documentation] ( #documentation )
@@ -275,7 +275,7 @@ When declaring a new lint by hand and `cargo dev update_lints` is used, the lint
275
275
pass may have to be registered manually in the ` register_plugins ` function in
276
276
` clippy_lints/src/lib.rs ` :
277
277
278
- ``` rust
278
+ ``` rust,ignore
279
279
store.register_early_pass(|| Box::new(foo_functions::FooFunctions));
280
280
```
281
281
@@ -301,7 +301,7 @@ either [`EarlyLintPass`][early_lint_pass] or [`LateLintPass`][late_lint_pass].
301
301
302
302
In short, the ` LateLintPass ` has access to type information while the
303
303
` EarlyLintPass ` doesn't. If you don't need access to type information, use the
304
- ` EarlyLintPass ` . The ` EarlyLintPass ` is also faster. However linting speed
304
+ ` EarlyLintPass ` . The ` EarlyLintPass ` is also faster. However, linting speed
305
305
hasn't really been a concern with Clippy so far.
306
306
307
307
Since we don't need type information for checking the function name, we used
@@ -318,7 +318,7 @@ implementation of the lint logic.
318
318
319
319
Let's start by implementing the ` EarlyLintPass ` for our ` FooFunctions ` :
320
320
321
- ``` rust
321
+ ``` rust,ignore
322
322
impl EarlyLintPass for FooFunctions {
323
323
fn check_fn(&mut self, cx: &EarlyContext<'_>, fn_kind: FnKind<'_>, span: Span, _: NodeId) {
324
324
// TODO: Emit lint here
@@ -337,10 +337,10 @@ variety of lint emission functions. They can all be found in
337
337
[ ` clippy_utils/src/diagnostics.rs ` ] [ diagnostics ] .
338
338
339
339
` span_lint_and_help ` seems most appropriate in this case. It allows us to
340
- provide an extra help message and we can't really suggest a better name
340
+ provide an extra help message, and we can't really suggest a better name
341
341
automatically. This is how it looks:
342
342
343
- ``` rust
343
+ ``` rust,ignore
344
344
impl EarlyLintPass for FooFunctions {
345
345
fn check_fn(&mut self, cx: &EarlyContext<'_>, fn_kind: FnKind<'_>, span: Span, _: NodeId) {
346
346
span_lint_and_help(
@@ -479,7 +479,7 @@ the value from `clippy.toml`. This can be accounted for using the
479
479
` extract_msrv_attr!(LintContext) ` macro and passing
480
480
` LateContext ` /` EarlyContext ` .
481
481
482
- ``` rust
482
+ ``` rust,ignore
483
483
impl<'tcx> LateLintPass<'tcx> for ManualStrip {
484
484
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
485
485
...
@@ -493,7 +493,7 @@ the lint's test file, `tests/ui/manual_strip.rs` in this example. It should
493
493
have a case for the version below the MSRV and one with the same contents but
494
494
for the MSRV version itself.
495
495
496
- ``` rust
496
+ ``` rust,ignore
497
497
...
498
498
499
499
#[clippy::msrv = "1.44"]
@@ -524,7 +524,7 @@ define_Conf! {
524
524
525
525
If you have trouble implementing your lint, there is also the internal ` author `
526
526
lint to generate Clippy code that detects the offending pattern. It does not
527
- work for all of the Rust syntax, but can give a good starting point.
527
+ work for all the Rust syntax, but can give a good starting point.
528
528
529
529
The quickest way to use it, is the [ Rust playground:
530
530
play.rust-lang.org] [ author_example ] . Put the code you want to lint into the
@@ -617,7 +617,7 @@ output in the `stdout` part.
617
617
618
618
## PR Checklist
619
619
620
- Before submitting your PR make sure you followed all of the basic requirements:
620
+ Before submitting your PR make sure you followed all the basic requirements:
621
621
622
622
<!-- Sync this with `.github/PULL_REQUEST_TEMPLATE` -->
623
623
@@ -637,7 +637,7 @@ for some users. Adding a configuration is done in the following steps:
637
637
638
638
1 . Adding a new configuration entry to [ ` clippy_lints::utils::conf ` ] like this:
639
639
640
- ``` rust
640
+ ``` rust,ignore
641
641
/// Lint: LINT_NAME.
642
642
///
643
643
/// <The configuration field doc comment>
@@ -690,7 +690,7 @@ for some users. Adding a configuration is done in the following steps:
690
690
configuration value is now cloned or copied into a local value that is then
691
691
passed to the impl struct like this :
692
692
693
- ```rust
693
+ ```rust , ignore
694
694
// Default generated registration:
695
695
store . register_* _pass (|| box module :: StructName );
696
696
0 commit comments