Skip to content

Commit d9fe09f

Browse files
barafaeltyranron
andauthored
Minor housekeeping work for Clippy satisfaction (#310)
- сheck `not(feature = ...)` code in `cargo.lint` Makefile command Co-authored-by: Kai Ren <[email protected]>
1 parent 50f91d2 commit d9fe09f

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

Cargo.toml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,17 @@ repository = "https://github.com/cucumber-rs/cucumber"
1919
readme = "README.md"
2020
categories = ["asynchronous", "development-tools::testing"]
2121
keywords = ["cucumber", "testing", "bdd", "atdd", "async"]
22-
include = ["/src/", "/tests/json.rs", "/tests/junit.rs", "/tests/libtest.rs", "/tests/tracing.rs", "/tests/wait.rs", "/LICENSE-*", "/README.md", "/CHANGELOG.md"]
22+
include = [
23+
"/src/",
24+
"/tests/json.rs",
25+
"/tests/junit.rs",
26+
"/tests/libtest.rs",
27+
"/tests/tracing.rs",
28+
"/tests/wait.rs",
29+
"/CHANGELOG.md",
30+
"/LICENSE-*",
31+
"/README.md",
32+
]
2333

2434
[package.metadata.docs.rs]
2535
all-features = true
@@ -30,9 +40,21 @@ default = ["macros"]
3040
# Enables compatibility with Rust libtest (like outputting in its JSON format).
3141
libtest = ["dep:serde", "dep:serde_json", "timestamps"]
3242
# Enables step attributes and auto-wiring.
33-
macros = ["dep:anyhow", "dep:cucumber-codegen", "dep:cucumber-expressions", "dep:inventory"]
43+
macros = [
44+
"dep:anyhow",
45+
"dep:cucumber-codegen",
46+
"dep:cucumber-expressions",
47+
"dep:inventory",
48+
]
3449
# Enables support for outputting in Cucumber JSON format.
35-
output-json = ["dep:base64", "dep:Inflector", "dep:mime", "dep:serde", "dep:serde_json", "timestamps"]
50+
output-json = [
51+
"dep:base64",
52+
"dep:Inflector",
53+
"dep:mime",
54+
"dep:serde",
55+
"dep:serde_json",
56+
"timestamps",
57+
]
3658
# Enables support for outputting JUnit XML report.
3759
output-junit = ["dep:junit-report", "timestamps"]
3860
# Enables timestamps collecting for all events.

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ cargo.fmt:
7373
# make cargo.lint
7474

7575
cargo.lint:
76+
cargo clippy --workspace -- -D warnings
7677
cargo clippy --workspace --all-features -- -D warnings
7778

7879

src/event.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ pub struct Event<T: ?Sized> {
5353

5454
impl<T> Event<T> {
5555
/// Creates a new [`Event`] out of the given `value`.
56+
#[cfg_attr(
57+
not(feature = "timestamps"),
58+
allow(clippy::missing_const_for_fn)
59+
)]
5660
#[must_use]
5761
pub fn new(value: T) -> Self {
5862
Self {

src/runner/basic.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ async fn execute<W, Before, After>(
10741074
}
10751075
}
10761076
#[cfg(not(feature = "tracing"))]
1077-
let _ = id;
1077+
let _: ScenarioId = id;
10781078

10791079
if fail_fast && scenario_failed && !retried {
10801080
started_scenarios = ControlFlow::Break(());
@@ -1485,7 +1485,7 @@ where
14851485
(fut, span_id)
14861486
};
14871487
#[cfg(not(feature = "tracing"))]
1488-
let _ = scenario_id;
1488+
let _: ScenarioId = scenario_id;
14891489

14901490
let result = fut.then_yield().await;
14911491

@@ -1606,7 +1606,7 @@ where
16061606
waiter.wait_for_span_close(id).then_yield().await;
16071607
}
16081608
#[cfg(not(feature = "tracing"))]
1609-
let _ = scenario_id;
1609+
let _: ScenarioId = scenario_id;
16101610

16111611
match result {
16121612
Ok((Some(captures), loc, Some(world))) => {
@@ -1762,7 +1762,7 @@ where
17621762
(fut, span_id)
17631763
};
17641764
#[cfg(not(feature = "tracing"))]
1765-
let _ = scenario_id;
1765+
let _: ScenarioId = scenario_id;
17661766

17671767
let res = fut.then_yield().await;
17681768

0 commit comments

Comments
 (0)