Skip to content

Commit 741adda

Browse files
committed
rocket linting issues
1 parent 44b9521 commit 741adda

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

pages/rocket-linting.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: Rocket liniting issues
3+
timestamp: 2024-01-18T18:10:01
4+
author: szabgab
5+
published: true
6+
description: Demonstrating and dealing with linting issues in web applications written using Rust Rocket.
7+
tags:
8+
- Rocket
9+
- Clippy
10+
- lint
11+
---
12+
13+
Recently I started to use Clippy extensively and also applied it to my [Rocket](/rocket)-based projects.
14+
15+
On this page I am going to collected the linting issues I've encountered and hope to also provide answers.
16+
17+
18+
![](examples/rocket/lint/Cargo.toml)
19+
20+
![](examples/rocket/lint/src/main.rs)
21+
22+
23+
```
24+
cargo clippy -- -Dclippy::no_effect_underscore_binding
25+
```
26+
27+
complains:
28+
29+
```
30+
31+
Checking lint v0.1.0 (/home/gabor/work/rust.code-maven.com/lint)
32+
error: binding to `_` prefixed variable with no side-effect
33+
--> src/main.rs:15:17
34+
|
35+
15 | hello_world
36+
| ^^^^^^^^^^^
37+
|
38+
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#no_effect_underscore_binding
39+
= note: requested on the command line with `-D clippy::no-effect-underscore-binding`
40+
41+
error: binding to `_` prefixed variable with no side-effect
42+
--> src/main.rs:15:17
43+
|
44+
15 | hello_world
45+
| ^^^^^^^^^^^
46+
|
47+
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#no_effect_underscore_binding
48+
49+
error: binding to `_` prefixed variable with no side-effect
50+
--> src/main.rs:10:16
51+
|
52+
10 | fn rocket() -> _ {
53+
| ^
54+
|
55+
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#no_effect_underscore_binding
56+
57+
error: could not compile `lint` (bin "lint") due to 3 previous errors
58+
```
59+
60+
Reported as [no_effect_underscore_binding false positive for Rocket routes](https://github.com/rust-lang/rust-clippy/issues/12166)
61+
62+
63+
64+

pages/rocket.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ code of each one of them from [Rust Maven GitHub repo](https://github.com/szabga
3232
* [Single counter in a plain text file](/rocket-single-counter-in-text-file).
3333
* [Multi-counter using cookies](/rocket-multi-counter-using-cookies) - `CookieJar`, `add`, `get`.
3434
* [Multi counter using encrypted cookies](/rocket-multi-counter-using-encrypted-cookies) - `add_private`, `get_private`, `secret_key`,`Rocket.toml`, `private_cookie`.
35+
* [Liniting issues with Rocket](/rocket-linting) - Clippy

0 commit comments

Comments
 (0)