Skip to content

Commit 08f4c02

Browse files
committed
fix clippy lint and use Rust 1.57 for clippy and trybuild
1 parent 28bb8c7 commit 08f4c02

File tree

3 files changed

+38
-26
lines changed

3 files changed

+38
-26
lines changed

.github/workflows/rust.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,17 @@ jobs:
4343
- uses: actions/checkout@v2
4444
- uses: dtolnay/rust-toolchain@master
4545
with:
46-
toolchain: "1.56"
46+
toolchain: "1.57"
47+
- name: Get Rust Version
48+
id: rust-version
49+
run: echo "::set-output name=version::$(cargo -V | head -n1 | awk '{print $2}')"
4750
- uses: actions/cache@v2
4851
with:
4952
path: |
50-
~/.cargo
53+
~/.cargo/git
54+
~/.cargo/registry
5155
target
52-
key: ${{ runner.os }}-cargo-1.56
56+
key: ${{ runner.os }}-rust-${{ steps.rust-version.outputs.version }}-trybuild
5357
- run: cargo test -- trybuild
5458
env:
5559
RUST_BACKTRACE: 1
@@ -58,8 +62,9 @@ jobs:
5862
runs-on: ubuntu-latest
5963
steps:
6064
- uses: actions/checkout@v2
61-
- uses: dtolnay/rust-toolchain@stable
65+
- uses: dtolnay/rust-toolchain@master
6266
with:
67+
toolchain: "1.57"
6368
components: clippy
6469
- name: Get Rust Version
6570
id: rust-version

derive/src/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use syn::{
1010
};
1111

1212
pub(super) enum TypeOrInline {
13-
Type(Type),
13+
Type(Box<Type>),
1414
Inline(ParseData)
1515
}
1616

@@ -97,7 +97,7 @@ fn parse_named_fields(named_fields: &FieldsNamed, rename_all: Option<&LitStr>) -
9797
fields.push(ParseDataField {
9898
name,
9999
doc,
100-
ty: TypeOrInline::Type(ty),
100+
ty: TypeOrInline::Type(Box::new(ty)),
101101
flatten: attrs.flatten
102102
});
103103
}
Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
11
error[E0599]: the function or associated item `schema` exists for struct `Foo<Bar>`, but its trait bounds were not satisfied
2-
--> tests/fail/not_openapitype_generics.rs:11:14
3-
|
4-
4 | struct Foo<T> {
5-
| -------------
6-
| |
7-
| function or associated item `schema` not found for this
8-
| doesn't satisfy `Foo<Bar>: OpenapiType`
2+
--> tests/fail/not_openapitype_generics.rs:11:14
3+
|
4+
4 | struct Foo<T> {
5+
| -------------
6+
| |
7+
| function or associated item `schema` not found for this
8+
| doesn't satisfy `Foo<Bar>: OpenapiType`
99
...
10-
8 | struct Bar;
11-
| ----------- doesn't satisfy `Bar: OpenapiType`
10+
8 | struct Bar;
11+
| ----------- doesn't satisfy `Bar: OpenapiType`
1212
...
13-
11 | <Foo<Bar>>::schema();
14-
| ^^^^^^ function or associated item cannot be called on `Foo<Bar>` due to unsatisfied trait bounds
15-
|
16-
= note: the following trait bounds were not satisfied:
17-
`Bar: OpenapiType`
18-
which is required by `Foo<Bar>: OpenapiType`
19-
`Foo<Bar>: OpenapiType`
20-
which is required by `&Foo<Bar>: OpenapiType`
21-
= help: items from traits can only be used if the trait is implemented and in scope
22-
= note: the following trait defines an item `schema`, perhaps you need to implement it:
23-
candidate #1: `OpenapiType`
13+
11 | <Foo<Bar>>::schema();
14+
| ^^^^^^ function or associated item cannot be called on `Foo<Bar>` due to unsatisfied trait bounds
15+
|
16+
= note: the following trait bounds were not satisfied:
17+
`Bar: OpenapiType`
18+
which is required by `Foo<Bar>: OpenapiType`
19+
`Foo<Bar>: OpenapiType`
20+
which is required by `&Foo<Bar>: OpenapiType`
21+
note: the following trait must be implemented
22+
--> src/lib.rs
23+
|
24+
| / pub trait OpenapiType {
25+
| | fn schema() -> OpenapiSchema;
26+
| | }
27+
| |_^
28+
= help: items from traits can only be used if the trait is implemented and in scope
29+
= note: the following trait defines an item `schema`, perhaps you need to implement it:
30+
candidate #1: `OpenapiType`

0 commit comments

Comments
 (0)