Skip to content

Commit 79a543f

Browse files
committed
Bump dependencies and fix new clippy feedbacks
1 parent 0f7ee3e commit 79a543f

File tree

7 files changed

+76
-44
lines changed

7 files changed

+76
-44
lines changed

.github/workflows/rust.yml

+59-23
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,65 @@
1-
name: Rust
2-
3-
on:
4-
push:
5-
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
8-
1+
on: [push, pull_request]
2+
name: Build and Test checks
93
env:
104
CARGO_TERM_COLOR: always
11-
125
jobs:
13-
test:
14-
runs-on: ubuntu-latest
6+
rustfmt:
7+
name: Rustfmt check
8+
runs-on: ubuntu-20.04
159
steps:
16-
- name: Install latest nightly
17-
uses: actions-rs/toolchain@v1
18-
with:
19-
toolchain: nightly
20-
default: true
10+
- uses: actions/checkout@v2
11+
- uses: actions-rs/toolchain@v1
12+
with:
13+
toolchain: stable
2114
override: true
22-
target: thumbv7em-none-eabihf
23-
components: rustfmt, clippy
15+
profile: minimal
16+
- name: "Rustfmt"
17+
uses: actions-rs/cargo@v1
18+
with:
19+
command: fmt
20+
args: -- --check
2421

25-
- uses: actions/checkout@v2
26-
- name: check style
27-
run: cargo fmt -- --check
28-
- name: Test
29-
run: ./tests.sh
22+
build_and_test:
23+
name: "Build and test"
24+
runs-on: ubuntu-20.04
25+
strategy:
26+
matrix:
27+
features: [
28+
"parse-comments",
29+
"parse-trailing-comment",
30+
"parse-trailing-comment,parse-comments",
31+
"parse-checksum",
32+
"parse-trailing-comment,parse-checksum",
33+
"parse-trailing-comment,parse-comments,parse-checksum",
34+
"optional-value",
35+
"string-value",
36+
"parse-parameters",
37+
"parse-parameters,optional-value",
38+
"parse-parameters,string-value",
39+
"parse-expressions",
40+
"parse-expressions,parse-parameters",
41+
"parse-comments,parse-trailing-comment,parse-checksum,parse-parameters,parse-expressions,optional-value,string-value"
42+
]
43+
steps:
44+
- uses: actions/checkout@v2
45+
- uses: actions-rs/toolchain@v1
46+
with:
47+
toolchain: stable
48+
target: thumbv7em-none-eabihf
49+
override: true
50+
profile: minimal
51+
- name: "Clippy"
52+
uses: actions-rs/cargo@v1
53+
with:
54+
command: clippy
55+
args: --examples --features ${{ matrix.features }} -- -Dwarnings
56+
- name: "Build"
57+
uses: actions-rs/cargo@v1
58+
with:
59+
command: build
60+
args: --release --no-default-features --features ${{ matrix.features }}
61+
- name: "Test"
62+
uses: actions-rs/cargo@v1
63+
with:
64+
command: test
65+
args: --target x86_64-unknown-linux-gnu --features ${{ matrix.features }}

Cargo.toml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[package]
22
name = "async-gcode"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
authors = ["Wilfried Chauveau <[email protected]>"]
55
description = "An async gcode parser for no_std targets."
66
keywords = ["async", "await", "gcode"]
77
license = "MIT"
8-
edition = "2018"
8+
edition = "2021"
99
repository = "https://github.com/ithinuel/async-gcode"
1010
categories = ["asynchronous", "embedded", "no-std", "parsing"]
1111

@@ -24,9 +24,9 @@ string-value = []
2424
maintenance = { status = "experimental" }
2525

2626
[dev-dependencies]
27-
futures-executor = { version = "0.3.5" }
27+
futures-executor = { version = "0.3.21" }
2828

2929
[dependencies]
3030
either = {version = "^1", default-features = false }
31-
futures = { version = "0.3.5", default-features = false }
32-
pin-project-lite = { version = "0.1.7" }
31+
futures = { version = "0.3.21", default-features = false }
32+
pin-project-lite = { version = "0.2.9" }

examples/cli.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@ fn main() {
1818
std::io::stdin().bytes().map(|res| res.map_err(Error::Io)),
1919
));
2020

21-
loop {
22-
if let Some(res) = parser.next().await {
23-
println!("{:?}", res);
24-
} else {
25-
break;
26-
}
21+
while let Some(res) = parser.next().await {
22+
println!("{:?}", res);
2723
}
2824
});
2925
}

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub use types::RealValue;
105105
#[cfg(any(feature = "parse-expressions", feature = "parse-parameters"))]
106106
pub use types::expressions::Expression;
107107

108-
#[derive(Debug, PartialEq, Clone, Copy)]
108+
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
109109
pub enum Error {
110110
/// Error no the gcode syntax
111111
UnexpectedByte(u8),

src/parser.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,14 @@ where
272272
let param_id = match try_await!(parse_real_value(&mut self.input)) {
273273
#[cfg(feature = "optional-value")]
274274
crate::RealValue::None => {
275-
let b = try_await_result!((&mut self.input).next());
275+
let b = try_await_result!(self.input.next());
276276
break Err(Error::UnexpectedByte(b).into());
277277
}
278278
id => id,
279279
};
280280
// println!("param_id: {:?}", param_id);
281281
try_await_result!(skip_whitespaces(&mut self.input));
282-
let b = try_await_result!((&mut self.input).next());
282+
let b = try_await_result!(self.input.next());
283283
if b'=' != b {
284284
break Err(Error::UnexpectedByte(b).into());
285285
}

src/types.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,18 @@ pub(crate) mod expressions {
106106
pub(crate) type ExprItem = Either<Operator, Literal>;
107107
pub(crate) type ExprInner = Vec<ExprItem>;
108108

109-
#[derive(Debug, PartialEq, Clone, Copy)]
109+
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
110110
pub enum OpType {
111111
Unary,
112112
Binary,
113113
}
114-
#[derive(Debug, PartialEq, Clone, Copy)]
114+
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
115115
pub enum Associativity {
116116
Left,
117117
#[cfg(feature = "parse-parameters")]
118118
Right,
119119
}
120-
#[derive(Debug, Clone, Copy, PartialOrd, PartialEq)]
120+
#[derive(Debug, Clone, Copy, PartialOrd, PartialEq, Eq)]
121121
pub enum Precedence {
122122
Group1,
123123
Group2,
@@ -127,7 +127,7 @@ pub(crate) mod expressions {
127127
Group5,
128128
}
129129

130-
#[derive(Debug, PartialEq, Clone, Copy)]
130+
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
131131
pub enum Operator {
132132
// Binary operators
133133
Add,

tests.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ set -e
33

44
function run_test() {
55
echo $1
6-
cargo clippy --features $2
6+
cargo clippy --examples --features $2 -- -Dwarnings
77
cargo build --color=always --release --no-default-features \
88
--features $2 \
9-
--target thumbv7em-none-eabihf \
10-
-Z features=dev_dep
9+
--target thumbv7em-none-eabihf
1110
cargo test --color=always --features $2
11+
cargo clean
1212
}
1313

1414
cargo clippy

0 commit comments

Comments
 (0)