Skip to content

Commit cc4158f

Browse files
authored
Fix release build workflow; remove extra line in changelog (danlehmann#88)
* Fix release build workflow; remove extra line in changelog * Make examples no longer fail cargo test Makes the example a lot less useful, but I can't find a nicer way to stop this from failing the build.
1 parent d445dbc commit cc4158f

5 files changed

Lines changed: 41 additions & 33 deletions

File tree

.github/workflows/test-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
with:
2222
toolchain: stable
2323
- uses: actions-rs/cargo@v1
24+
with:
2425
command: test
2526
args: ${{ matrix.args }}
2627

bitbybit/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Changelog
22

3-
## unreleased
4-
53
## bitbybit 1.4.0
64

5+
This is the final version to support arbitrary-int 1.x. Future versions will require arbitrary-int 2.x.
6+
77
### Added
88

99
- `*_mask()`, as well as `*_BITS`, `*_COUNT`, and `*_STRIDE` constants for fields that provide some information on a
Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
use arbitrary_int::u4;
2-
use bitbybit::bitfield;
1+
#[cfg(feature = "examples")]
2+
pub fn main() {
3+
use arbitrary_int::u4;
4+
use bitbybit::bitfield;
35

4-
#[bitfield(u32, defmt_bitfields)]
5-
pub struct BitfieldU32 {
6-
#[bits(28..=31, rw)]
7-
val3: u4,
8-
#[bits(24..=27, rw)]
9-
val2: u4,
10-
#[bits(16..=23, rw)]
11-
val1: u8,
12-
#[bits(0..=15, rw)]
13-
val0: u16,
14-
}
6+
#[bitfield(u32, defmt_bitfields)]
7+
pub struct BitfieldU32 {
8+
#[bits(28..=31, rw)]
9+
val3: u4,
10+
#[bits(24..=27, rw)]
11+
val2: u4,
12+
#[bits(16..=23, rw)]
13+
val1: u8,
14+
#[bits(0..=15, rw)]
15+
val0: u16,
16+
}
1517

16-
pub fn main() {
1718
let bitfield = BitfieldU32::new_with_raw_value(0x0);
1819
defmt_impl_check(&bitfield);
1920
}
2021

2122
pub fn defmt_impl_check<T: defmt::Format>(_: &T) {}
23+
24+
#[cfg(not(feature = "examples"))]
25+
pub fn main() {}

bitbybit/examples/defmt_fields.rs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
use arbitrary_int::u4;
2-
use bitbybit::bitfield;
3-
4-
#[bitfield(u32, defmt_fields)]
5-
pub struct BitfieldU32 {
6-
#[bits(28..=31, rw)]
7-
val3: u4,
8-
#[bits(24..=27, rw)]
9-
val2: u4,
10-
#[bits(16..=23, rw)]
11-
val1: u8,
12-
#[bits(0..=15, rw)]
13-
val0: u16,
14-
}
15-
1+
#[cfg(feature = "examples")]
162
pub fn main() {
3+
use arbitrary_int::u4;
4+
use bitbybit::bitfield;
5+
#[bitfield(u32, defmt_fields)]
6+
pub struct BitfieldU32 {
7+
#[bits(28..=31, rw)]
8+
val3: u4,
9+
#[bits(24..=27, rw)]
10+
val2: u4,
11+
#[bits(16..=23, rw)]
12+
val1: u8,
13+
#[bits(0..=15, rw)]
14+
val0: u16,
15+
}
16+
1717
let bitfield = BitfieldU32::new_with_raw_value(0x0);
1818
defmt_impl_check(&bitfield);
1919
}
2020

2121
pub fn defmt_impl_check<T: defmt::Format>(_: &T) {}
22+
23+
#[cfg(not(feature = "examples"))]
24+
pub fn main() {}

bitbybit/src/bitfield/parsing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ fn parse_field(base_data_size: usize, field: &Field) -> Result<FieldDefinition>
205205
if !is_in_array && !is_range {
206206
return Err(Error::new_spanned(
207207
&range_span,
208-
"bitfield!: bit requires an inclusive range, for examples bits(10..=19). bit(10) allows specifying a single bit",
208+
"bitfield!: bit requires an inclusive range, for example bits(10..=19). bit(10) allows specifying a single bit",
209209
));
210210
}
211211
ranges.push(Range {
@@ -217,7 +217,7 @@ fn parse_field(base_data_size: usize, field: &Field) -> Result<FieldDefinition>
217217
if is_range && !is_in_array {
218218
return Err(Error::new_spanned(
219219
&range_span,
220-
"bitfield!: bits requires a single bit, for examples bit(10). bits(10..=12) can be used to specify multiple bits",
220+
"bitfield!: bits requires a single bit, for example bit(10). bits(10..=12) can be used to specify multiple bits",
221221
));
222222
}
223223
ranges.push(Range {

0 commit comments

Comments
 (0)