Skip to content

Commit dcea54f

Browse files
committed
Make clippy happy
1 parent 7d897e5 commit dcea54f

File tree

8 files changed

+12
-13
lines changed

8 files changed

+12
-13
lines changed

rstest/src/timeout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn execute_with_timeout_sync<T: 'static + Send, F: FnOnce() -> T + Send + 's
2323
handle.join().unwrap().unwrap();
2424
result
2525
}
26-
Err(mpsc::RecvTimeoutError::Timeout) => panic!("Timeout {:?} expired", timeout),
26+
Err(mpsc::RecvTimeoutError::Timeout) => panic!("Timeout {timeout:?} expired"),
2727
Err(mpsc::RecvTimeoutError::Disconnected) => match handle.join() {
2828
Err(any) => std::panic::resume_unwind(any),
2929
Ok(_) => unreachable!(),

rstest_macros/src/parse/arguments.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ impl Args {
9595
#[derive(Clone, PartialEq, Debug)]
9696
pub enum TestAttr {
9797
InAttrs,
98-
Explicit(syn::Attribute),
98+
Explicit(Box<syn::Attribute>),
9999
}
100100

101101
impl From<syn::Attribute> for TestAttr {
102102
fn from(attr: syn::Attribute) -> Self {
103-
TestAttr::Explicit(attr)
103+
TestAttr::Explicit(attr.into())
104104
}
105105
}
106106

rstest_macros/src/parse/fixture.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ pub(crate) struct FixtureData {
173173
impl FixtureData {
174174
pub(crate) fn fixtures(&self) -> impl Iterator<Item = &Fixture> {
175175
self.items.iter().filter_map(|f| match f {
176-
FixtureItem::Fixture(ref fixture) => Some(fixture),
176+
FixtureItem::Fixture(ref fixture) => Some(fixture.as_ref()),
177177
_ => None,
178178
})
179179
}
@@ -212,13 +212,13 @@ impl ArgumentValue {
212212

213213
#[derive(PartialEq, Debug)]
214214
pub(crate) enum FixtureItem {
215-
Fixture(Fixture),
215+
Fixture(Box<Fixture>),
216216
ArgumentValue(Box<ArgumentValue>),
217217
}
218218

219219
impl From<Fixture> for FixtureItem {
220220
fn from(f: Fixture) -> Self {
221-
FixtureItem::Fixture(f)
221+
FixtureItem::Fixture(f.into())
222222
}
223223
}
224224

@@ -235,7 +235,7 @@ impl Parse for FixtureItem {
235235
impl RefPat for FixtureItem {
236236
fn pat(&self) -> &Pat {
237237
match self {
238-
FixtureItem::Fixture(Fixture { ref arg, .. }) => arg,
238+
FixtureItem::Fixture(ref fix) => &fix.arg,
239239
FixtureItem::ArgumentValue(ref av) => &av.arg,
240240
}
241241
}

rstest_macros/src/parse/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ impl VisitMut for PartialsTypeFunctionExtractor {
334334
Err(e) => errors.push(e),
335335
}
336336
}
337-
self.0 = if errors.len() > 0 {
337+
self.0 = if !errors.is_empty() {
338338
Err(errors)
339339
} else {
340340
Ok(data)

rstest_macros/src/parse/rstest/files.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ impl FilesGlobReferences {
8585
(None, _) if ignore_missing => String::new(),
8686
(None, _) => {
8787
return Err(attr.error(&format!(
88-
"Could not find the environment variable {:?}",
89-
var_name
88+
"Could not find the environment variable {var_name:?}"
9089
)))
9190
}
9291
};

rstest_macros/src/parse/rstest/test_attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ mod should {
7070
use crate::test::{attr, ToAst};
7171

7272
fn explicit(a: &str) -> TestAttr {
73-
TestAttr::Explicit(attr(format!("#[{a}]")))
73+
TestAttr::Explicit(attr(format!("#[{a}]")).into())
7474
}
7575

7676
fn in_attrs() -> TestAttr {

rstest_macros/src/render/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1978,7 +1978,7 @@ mod test_attribute_should {
19781978
let mut out = String::from("#[rstest]\n");
19791979
match attr_style {
19801980
TestAttrStyle::Explicit => {
1981-
info.arguments.set_test_attr(Some(TestAttr::Explicit(attr("#[my_explicit_test_attr]"))));
1981+
info.arguments.set_test_attr(Some(TestAttr::Explicit(attr("#[my_explicit_test_attr]").into())));
19821982
}
19831983
TestAttrStyle::Implicit => {
19841984
info.arguments.set_test_attr(Some(TestAttr::InAttrs));

rstest_test/src/prj.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl Project {
150150
self
151151
}
152152

153-
code => panic!("cargo init return an error code: {}", code),
153+
code => panic!("cargo init return an error code: {code}"),
154154
}
155155
}
156156

0 commit comments

Comments
 (0)