Skip to content

Commit e508b52

Browse files
author
Jorge Aparicio
committed
don't use unstable features, and test on nightly
1 parent 62a58d1 commit e508b52

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

.travis.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ language: rust
33
services: docker
44
sudo: required
55

6-
rust: stable
7-
86
env:
97
global:
108
- CRATE_NAME=svd2rust
@@ -14,16 +12,20 @@ matrix:
1412
include:
1513
# Linux
1614
- env: TARGET=i686-unknown-linux-gnu DISABLE_TESTS=1
17-
- env: TARGET=i686-unknown-linux-musl
18-
# - env: TARGET=x86_64-unknown-linux-gnu # this is the default job
19-
- env: TARGET=x86_64-unknown-linux-musl
15+
- env: TARGET=i686-unknown-linux-musl DISABLE_TESTS=1
16+
- env: TARGET=x86_64-unknown-linux-gnu DISABLE_TESTS=1
17+
- env: TARGET=x86_64-unknown-linux-musl DISABLE_TESTS=1
2018

2119
# OSX
22-
- env: TARGET=i686-apple-darwin
20+
- env: TARGET=i686-apple-darwin DISABLE_TESTS=1
2321
os: osx
24-
- env: TARGET=x86_64-apple-darwin
22+
- env: TARGET=x86_64-apple-darwin DISABLE_TESTS=1
2523
os: osx
2624

25+
# Nightly, for testing
26+
- env: TARGET=x86_64-unknown-linux-gnu
27+
rust: nightly
28+
2729
install:
2830
- sh ci/install.sh
2931
- source ~/.cargo/env || true

src/generate.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::collections::HashMap;
12
use std::io::{self, Write};
23

34
use cast::u64;
@@ -40,11 +41,12 @@ pub fn device(d: &Device, items: &mut Vec<Tokens>) -> Result<()> {
4041

4142
/// Generates code for `src/interrupt.rs`
4243
pub fn interrupt(peripherals: &[Peripheral], items: &mut Vec<Tokens>) {
43-
let mut interrupts =
44-
peripherals.iter().flat_map(|p| p.interrupt.iter()).collect::<Vec<_>>();
44+
let interrupts = peripherals.iter()
45+
.flat_map(|p| p.interrupt.iter())
46+
.map(|i| (i.value, i))
47+
.collect::<HashMap<_, _>>();
4548

46-
interrupts.sort_by_key(|i| i.value);
47-
interrupts.dedup_by_key(|i| i.value);
49+
let interrupts = interrupts.into_iter().map(|(_, v)| v).collect::<Vec<_>>();
4850

4951
let mut fields = vec![];
5052
let mut exprs = vec![];
@@ -492,12 +494,12 @@ pub fn fields(
492494
description.push_str(&*util::respace(d));
493495
}
494496
Ok(F {
495-
_pc_w,
496-
_sc,
497-
description,
498-
pc_r,
499-
pc_w,
500-
width,
497+
_pc_w: _pc_w,
498+
_sc: _sc,
499+
description: description,
500+
pc_r: pc_r,
501+
pc_w: pc_w,
502+
width: width,
501503
access: f.access,
502504
evs: &f.enumerated_values,
503505
sc: Ident::new(&*sc),
@@ -560,11 +562,11 @@ pub fn fields(
560562
ev.name)
561563
})?);
562564
Ok(Variant {
563-
description,
564-
sc,
565+
description: description,
566+
sc: sc,
565567
pc: Ident::new(&*ev.name
566568
.to_sanitized_pascal_case()),
567-
value,
569+
value: value,
568570
})
569571
})
570572
.collect::<Result<Vec<_>>>()?;

src/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ fn lookup_in_register<'r>
374374
if matches.len() == 1 {
375375
return Ok((evs,
376376
Some(Base {
377-
field,
377+
field: field,
378378
register: None,
379379
})));
380380
} else {

0 commit comments

Comments
 (0)