Skip to content

Commit b658a82

Browse files
committed
compile & test syn2 and syn3 simultaneously
1 parent bb80796 commit b658a82

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

‎.github/workflows/test.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ jobs:
3838
with:
3939
crate: cargo-hack
4040
- name: Build
41-
run: cargo hack build --feature-powerset --mutually-exclusive-features=syn2,syn3 ${{ matrix.cargo_flags }}
41+
run: cargo hack build --all-features ${{ matrix.cargo_flags }}
4242
- name: Test
43-
run: cargo hack test --feature-powerset --mutually-exclusive-features=syn2,syn3 --all-targets --no-fail-fast --workspace
43+
run: cargo hack test --all-features --all-targets --no-fail-fast --workspace
4444
- name: Doc Test
4545
run: cargo test --features=darling --doc --no-fail-fast --workspace
4646
- name: Build Docs
47-
run: cargo doc --all-features --workspace
47+
run: cargo doc --all-features --workspace

‎src/lib.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ macro_rules! __macro_handler {
276276
$crate::__macro_handler! {! $name; $($(#attr=$attr)? $n: $input),+; $impl; $crate::__private::Dummy::None}
277277
};
278278
(! $name:ident; $($(#attr=$attr:tt)? $n:ident: $input:expr),+; $impl:expr $(; $dummy:expr)?) => {{
279-
use $crate::__private::{ManyhowParse, ManyhowToTokens, ManyhowTry};
279+
#[allow(unused_imports)]
280+
use $crate::__private::{ManyhowParse, ManyhowParseSyn2, ManyhowParseSyn3, ManyhowToTokens, ManyhowTry};
280281
let implementation = $impl;
281282
$(let $n = &$crate::__private::WhatType::new();)+
282283
if false {

‎src/parse_to_tokens.rs‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ pub trait ManyhowParse<T> {
1313
fn manyhow_parse(&self, input: impl AnyTokenStream, attr: bool) -> Result<T, TokenStream>;
1414
}
1515

16+
pub trait ManyhowParseSyn2<T> {
17+
fn manyhow_parse(&self, input: impl AnyTokenStream, attr: bool) -> Result<T, TokenStream>;
18+
}
19+
20+
pub trait ManyhowParseSyn3<T> {
21+
fn manyhow_parse(&self, input: impl AnyTokenStream, attr: bool) -> Result<T, TokenStream>;
22+
}
23+
1624
pub trait ManyhowToTokens<T> {
1725
fn manyhow_to_tokens(&self, input: T, tokens: &mut TokenStream);
1826
}
@@ -99,7 +107,7 @@ impl<T> ManyhowTry<T> for &WhatType<T> {
99107
}
100108

101109
#[cfg(all(feature = "syn2", not(doc)))]
102-
impl<T: syn2::parse::Parse> ManyhowParse<T> for &WhatType<T> {
110+
impl<T: syn2::parse::Parse> ManyhowParseSyn2<T> for &WhatType<T> {
103111
fn manyhow_parse(&self, input: impl AnyTokenStream, attr: bool) -> Result<T, TokenStream> {
104112
let input = input.into();
105113
let empty = input.is_empty();
@@ -117,7 +125,7 @@ impl<T: syn2::parse::Parse> ManyhowParse<T> for &WhatType<T> {
117125
#[cfg(all(feature = "syn2", not(doc)))]
118126
#[test]
119127
#[allow(unused)]
120-
fn test_inference() {
128+
fn syn2_test_inference() {
121129
use syn2::parse::Parse;
122130

123131
if false {
@@ -142,7 +150,7 @@ fn test_inference() {
142150
}
143151

144152
#[cfg(feature = "syn3")]
145-
impl<T: syn3::parse::Parse> ManyhowParse<T> for &WhatType<T> {
153+
impl<T: syn3::parse::Parse> ManyhowParseSyn3<T> for &WhatType<T> {
146154
fn manyhow_parse(&self, input: impl AnyTokenStream, attr: bool) -> Result<T, TokenStream> {
147155
let input = input.into();
148156
let empty = input.is_empty();
@@ -160,7 +168,7 @@ impl<T: syn3::parse::Parse> ManyhowParse<T> for &WhatType<T> {
160168
#[cfg(feature = "syn3")]
161169
#[test]
162170
#[allow(unused)]
163-
fn test_inference() {
171+
fn syn3_test_inference() {
164172
use syn3::parse::Parse;
165173

166174
if false {

0 commit comments

Comments
 (0)