Skip to content

Commit

Permalink
Minor housekeeping work for Clippy satisfaction (#310)
Browse files Browse the repository at this point in the history
- сheck `not(feature = ...)` code in `cargo.lint` Makefile command

Co-authored-by: Kai Ren <[email protected]>
  • Loading branch information
barafael and tyranron authored Nov 21, 2023
1 parent 50f91d2 commit d9fe09f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
28 changes: 25 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@ repository = "https://github.com/cucumber-rs/cucumber"
readme = "README.md"
categories = ["asynchronous", "development-tools::testing"]
keywords = ["cucumber", "testing", "bdd", "atdd", "async"]
include = ["/src/", "/tests/json.rs", "/tests/junit.rs", "/tests/libtest.rs", "/tests/tracing.rs", "/tests/wait.rs", "/LICENSE-*", "/README.md", "/CHANGELOG.md"]
include = [
"/src/",
"/tests/json.rs",
"/tests/junit.rs",
"/tests/libtest.rs",
"/tests/tracing.rs",
"/tests/wait.rs",
"/CHANGELOG.md",
"/LICENSE-*",
"/README.md",
]

[package.metadata.docs.rs]
all-features = true
Expand All @@ -30,9 +40,21 @@ default = ["macros"]
# Enables compatibility with Rust libtest (like outputting in its JSON format).
libtest = ["dep:serde", "dep:serde_json", "timestamps"]
# Enables step attributes and auto-wiring.
macros = ["dep:anyhow", "dep:cucumber-codegen", "dep:cucumber-expressions", "dep:inventory"]
macros = [
"dep:anyhow",
"dep:cucumber-codegen",
"dep:cucumber-expressions",
"dep:inventory",
]
# Enables support for outputting in Cucumber JSON format.
output-json = ["dep:base64", "dep:Inflector", "dep:mime", "dep:serde", "dep:serde_json", "timestamps"]
output-json = [
"dep:base64",
"dep:Inflector",
"dep:mime",
"dep:serde",
"dep:serde_json",
"timestamps",
]
# Enables support for outputting JUnit XML report.
output-junit = ["dep:junit-report", "timestamps"]
# Enables timestamps collecting for all events.
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ cargo.fmt:
# make cargo.lint

cargo.lint:
cargo clippy --workspace -- -D warnings
cargo clippy --workspace --all-features -- -D warnings


Expand Down
4 changes: 4 additions & 0 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ pub struct Event<T: ?Sized> {

impl<T> Event<T> {
/// Creates a new [`Event`] out of the given `value`.
#[cfg_attr(
not(feature = "timestamps"),
allow(clippy::missing_const_for_fn)
)]
#[must_use]
pub fn new(value: T) -> Self {
Self {
Expand Down
8 changes: 4 additions & 4 deletions src/runner/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ async fn execute<W, Before, After>(
}
}
#[cfg(not(feature = "tracing"))]
let _ = id;
let _: ScenarioId = id;

if fail_fast && scenario_failed && !retried {
started_scenarios = ControlFlow::Break(());
Expand Down Expand Up @@ -1485,7 +1485,7 @@ where
(fut, span_id)
};
#[cfg(not(feature = "tracing"))]
let _ = scenario_id;
let _: ScenarioId = scenario_id;

let result = fut.then_yield().await;

Expand Down Expand Up @@ -1606,7 +1606,7 @@ where
waiter.wait_for_span_close(id).then_yield().await;
}
#[cfg(not(feature = "tracing"))]
let _ = scenario_id;
let _: ScenarioId = scenario_id;

match result {
Ok((Some(captures), loc, Some(world))) => {
Expand Down Expand Up @@ -1762,7 +1762,7 @@ where
(fut, span_id)
};
#[cfg(not(feature = "tracing"))]
let _ = scenario_id;
let _: ScenarioId = scenario_id;

let res = fut.then_yield().await;

Expand Down

0 comments on commit d9fe09f

Please sign in to comment.