Warning clippy : conseils sur comment mieux coder
Clippy qui fait de l'analyse statique lègère dit des trucs interresant comme: t'aurais pu utiliser des ranges, qye des boucles sont pas des boucles etc.
warning: manual `RangeInclusive::contains` implementation
--> src/affichage.rs:58:12
|
58 | if SCORE >= 0 && SCORE <= 15 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(0..=15).contains(&SCORE)`
|
= note: `#[warn(clippy::manual_range_contains)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
warning: manual `RangeInclusive::contains` implementation
--> src/affichage.rs:60:19
|
60 | } else if SCORE >= 15 && SCORE <= 30 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(15..=30).contains(&SCORE)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
warning: manual `RangeInclusive::contains` implementation
--> src/affichage.rs:62:19
|
62 | } else if SCORE >= 30 && SCORE <= 50 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(30..=50).contains(&SCORE)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
warning: manual `RangeInclusive::contains` implementation
--> src/affichage.rs:64:19
|
64 | } else if SCORE >= 50 && SCORE <= 80 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(50..=80).contains(&SCORE)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
warning: manual `RangeInclusive::contains` implementation
--> src/affichage.rs:66:19
|
66 | } else if SCORE >= 80 && SCORE <= 120 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(80..=120).contains(&SCORE)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
warning: manual `RangeInclusive::contains` implementation
--> src/affichage.rs:69:17
|
69 | else if SCORE >= 120 && SCORE <= 150 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `(120..=150).contains(&SCORE)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
error: this loop never actually loops
--> src/collisions.rs:36:13
|
36 | / while JOUEUR_X > 130.0 {
37 | | if is_key_down(Left) {
38 | | //incrementate l'axe X du joueur
39 | | JOUEUR_X -= 5.0;
40 | | }
41 | | break
42 | | }
| |_____________^
|
= note: `#[deny(clippy::never_loop)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop
error: this loop never actually loops
--> src/collisions.rs:43:13
|
43 | / while JOUEUR_X < 670.0 {
44 | | if is_key_down(Right) {
45 | | JOUEUR_X += 5.0;
46 | | }
47 | | break
48 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop
error: this loop never actually loops
--> src/collisions.rs:52:13
|
52 | / while JOUEUR_X > 130.0 {
53 | | if is_key_down(Right) {
54 | | //incrementate l'axe X du joueur
55 | | JOUEUR_X -= 5.0;
56 | | }
57 | | break
58 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop
error: this loop never actually loops
--> src/collisions.rs:59:13
|
59 | / while JOUEUR_X < 670.0 {
60 | | if is_key_down(Left) {
61 | | JOUEUR_X += 5.0;
62 | | }
63 | | break
64 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop
error: this loop never actually loops
--> src/collisions.rs:99:9
|
99 | / while (FALL + 44.5) >= joueur.p1.y && (FALL - 44.5) <= joueur.p2.y {
100 | | if joueur.p1 <= carre.p3 && joueur.p3 >= carre.p1 {
101 | | GAME_OVER = true;
102 | | }
103 | | break
104 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop
error: this loop never actually loops
--> src/collisions.rs:125:9
|
125 | / while (FALL + 10.0) <= joueur.p1.y {
126 | | draw_circle(x, FALL, 10.0, GREEN);
127 | | break
128 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop
warning: crate `DodgetheWall` should have a snake case name
|
= note: `#[warn(non_snake_case)]` on by default
= help: convert the identifier to snake case: `dodgethe_wall`
warning: `DodgetheWall` (bin "DodgetheWall") generated 22 warnings
error: could not compile `DodgetheWall` due to 6 previous errors; 22 warnings emitted