Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #3 from stephanh/ci
Browse files Browse the repository at this point in the history
Set up CI
  • Loading branch information
dbrgn authored Mar 24, 2020
2 parents 46862fc + 1790ed1 commit fce9478
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 10 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
on: [push, pull_request]

name: Continuous integration

jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ numtoa = "0.2"
[dev-dependencies]
env_logger = "0.6"
log = "0.4"
serialport = { git = "https://gitlab.com/dbrgn/serialport-rs", branch = "embedded", features = ["embedded"] }
serialport = { git = "https://gitlab.com/dbrgn/serialport-rs", branch = "embedded", features = ["embedded"], default_features = false }
void = "1"

[features]
Expand Down
18 changes: 10 additions & 8 deletions src/commands/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ impl AtatCmd for SetWifiMode {
type Response = responses::EmptyResponse;

fn as_string(&self) -> String<Self::CommandLen> {
let mut string = String::from(match self.persist {
true => "AT+CWMODE_DEF=",
false => "AT+CWMODE_CUR=",
let mut string = String::from(if self.persist {
"AT+CWMODE_DEF="
} else {
"AT+CWMODE_CUR="
});
string.push_str(self.mode.as_at_str()).unwrap();
string.push_str("\r\n").unwrap();
Expand Down Expand Up @@ -244,9 +245,10 @@ impl AtatCmd for JoinAccessPoint {
type Response = responses::JoinResponse;

fn as_string(&self) -> String<Self::CommandLen> {
let mut string = String::from(match self.persist {
true => "AT+CWJAP_DEF=",
false => "AT+CWJAP_CUR=",
let mut string = String::from(if self.persist {
"AT+CWJAP_DEF="
} else {
"AT+CWJAP_CUR="
});
// TODO: Proper quoting
string.push('"').unwrap();
Expand Down Expand Up @@ -394,8 +396,8 @@ impl AtatCmd for EstablishConnection {
let octets = addr.ip().octets();
let mut buf = [0; 5];
string.push('"').unwrap();
for i in 0..=3 {
string.push_str(octets[i].numtoa_str(10, &mut buf)).unwrap();
for (i, octet) in octets.iter().enumerate() {
string.push_str(octet.numtoa_str(10, &mut buf)).unwrap();
if i != 3 {
string.push('.').unwrap();
}
Expand Down
1 change: 0 additions & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ pub enum ConnectionStatus {
Other(u8),
}


/// The ESP8266 can manage up to five parallel connections with id 0..4.
#[derive(Debug)]
pub enum ConnectionId {
Expand Down

0 comments on commit fce9478

Please sign in to comment.