Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(*): bump embedded-hal to rc.1 #65

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ublox-short-range/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ hash32 = "^0.2.1"
hash32-derive = "^0.1.0"

defmt = { version = "0.3" }
embedded-hal = "=1.0.0-alpha.11"
embedded-hal = "=1.0.0-rc.1"
embedded-nal = "0.6.0"
fugit = { version = "0.3", features = ["defmt"] }
fugit-timer = "0.1.2"
Expand Down
5 changes: 4 additions & 1 deletion ublox-short-range/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@
}

impl DNSTableEntry {
pub const fn new(state: DNSState, domain_name: heapless::String<MAX_DOMAIN_NAME_LENGTH>) -> Self {
pub const fn new(
state: DNSState,
domain_name: heapless::String<MAX_DOMAIN_NAME_LENGTH>,
) -> Self {
Self { domain_name, state }
}
}
Expand Down Expand Up @@ -105,7 +108,7 @@

pub fn get_state(
&self,
domain_name: heapless::String<MAX_DOMAIN_NAME_LENGTH>,

Check warning on line 111 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this argument is passed by value, but not consumed in the function body

warning: this argument is passed by value, but not consumed in the function body --> ublox-short-range/src/client.rs:111:22 | 111 | domain_name: heapless::String<MAX_DOMAIN_NAME_LENGTH>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&heapless::String<MAX_DOMAIN_NAME_LENGTH>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value = note: `-W clippy::needless-pass-by-value` implied by `-W clippy::pedantic`
) -> Option<DNSState> {
self.table
.iter()
Expand All @@ -113,14 +116,14 @@
.map(|x| x.state)
}
pub fn reverse_lookup(&self, ip: IpAddr) -> Option<&heapless::String<MAX_DOMAIN_NAME_LENGTH>> {
match self
.table
.iter()
.find(|e| e.state == DNSState::Resolved(ip))
{
Some(entry) => Some(&entry.domain_name),
None => None,
}

Check warning on line 126 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

use Option::map_or instead of an if let/else

warning: use Option::map_or instead of an if let/else --> ublox-short-range/src/client.rs:119:9 | 119 | / match self 120 | | .table 121 | | .iter() 122 | | .find(|e| e.state == DNSState::Resolved(ip)) ... | 125 | | None => None, 126 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else = note: `-W clippy::option-if-let-else` implied by `-W clippy::nursery` help: try | 119 ~ self 120 + .table 121 + .iter() 122 + .find(|e| e.state == DNSState::Resolved(ip)).map_or(None, |entry| Some(&entry.domain_name)) |
}
}

Expand All @@ -146,7 +149,7 @@
Ok(num)
}

pub struct UbloxClient<C, CLK, RST, const TIMER_HZ: u32, const N: usize, const L: usize>

Check warning on line 152 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

item name ends with its containing module's name

warning: item name ends with its containing module's name --> ublox-short-range/src/client.rs:152:12 | 152 | pub struct UbloxClient<C, CLK, RST, const TIMER_HZ: u32, const N: usize, const L: usize> | ^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions = note: `-W clippy::module-name-repetitions` implied by `-W clippy::pedantic`
where
C: atat::blocking::AtatClient,
CLK: fugit_timer::Timer<TIMER_HZ>,
Expand Down Expand Up @@ -176,7 +179,7 @@
RST: OutputPin,
{
pub fn new(client: C, timer: CLK, config: Config<RST>) -> Self {
UbloxClient {

Check warning on line 182 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

unnecessary structure name repetition

warning: unnecessary structure name repetition --> ublox-short-range/src/client.rs:182:9 | 182 | UbloxClient { | ^^^^^^^^^^^ help: use the applicable keyword: `Self` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self = note: `-W clippy::use-self` implied by `-W clippy::nursery`
module_started: false,
initialized: false,
serial_mode: SerialMode::Cmd,
Expand Down Expand Up @@ -207,7 +210,7 @@
self.sockets.is_some()
}

pub fn init(&mut self) -> Result<(), Error> {

Check warning on line 213 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section --> ublox-short-range/src/client.rs:213:5 | 213 | pub fn init(&mut self) -> Result<(), Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc = note: `-W clippy::missing-errors-doc` implied by `-W clippy::pedantic`
// Initilize a new ublox device to a known state (set RS232 settings)

debug!("Initializing wifi");
Expand Down Expand Up @@ -295,12 +298,12 @@
Ok(())
}

pub fn firmware_version(&mut self) -> Result<FirmwareVersion, Error> {

Check warning on line 301 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section --> ublox-short-range/src/client.rs:301:5 | 301 | pub fn firmware_version(&mut self) -> Result<FirmwareVersion, Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
let response = self.send_internal(&EdmAtCmdWrapper(SoftwareVersion), false)?;
Ok(response.version)
}

pub fn signal_strength(&mut self) -> Result<i16, Error> {

Check warning on line 306 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section --> ublox-short-range/src/client.rs:306:5 | 306 | pub fn signal_strength(&mut self) -> Result<i16, Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
if let WifiStatusResponse {
status_id: WifiStatus::RSSI(rssi),
} = self.send_internal(
Expand All @@ -315,13 +318,13 @@
}
}

pub fn retry_send<A, const LEN: usize>(
&mut self,
cmd: &A,
attempts: usize,
) -> Result<A::Response, Error>
where
A: atat::AtatCmd<LEN>,

Check warning on line 327 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section --> ublox-short-range/src/client.rs:321:5 | 321 | / pub fn retry_send<A, const LEN: usize>( 322 | | &mut self, 323 | | cmd: &A, 324 | | attempts: usize, 325 | | ) -> Result<A::Response, Error> 326 | | where 327 | | A: atat::AtatCmd<LEN>, | |______________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
{
for _ in 0..attempts {
match self.send_internal(cmd, true) {
Expand All @@ -334,7 +337,7 @@
Err(Error::BaudDetection)
}

pub fn reset(&mut self) -> Result<(), Error> {

Check warning on line 340 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section --> ublox-short-range/src/client.rs:340:5 | 340 | pub fn reset(&mut self) -> Result<(), Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
self.serial_mode = SerialMode::Cmd;
self.initialized = false;
self.module_started = false;
Expand Down Expand Up @@ -372,7 +375,7 @@
Ok(())
}

pub fn software_reset(&mut self) -> Result<(), Error> {

Check warning on line 378 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section --> ublox-short-range/src/client.rs:378:5 | 378 | pub fn software_reset(&mut self) -> Result<(), Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
self.serial_mode = SerialMode::Cmd;
self.initialized = false;
self.module_started = false;
Expand Down Expand Up @@ -418,7 +421,7 @@
Ok(())
}

pub fn spin(&mut self) -> Result<(), Error> {

Check warning on line 424 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section --> ublox-short-range/src/client.rs:424:5 | 424 | pub fn spin(&mut self) -> Result<(), Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
if !self.initialized {
return Err(Error::Uninitialized);
}
Expand Down Expand Up @@ -455,18 +458,18 @@
})
}

fn handle_urc(&mut self) -> Result<bool, Error> {
let mut ran = false;
let socket_set = self.sockets.as_deref_mut();
let socket_map = &mut self.socket_map;
let udp_listener = &mut self.udp_listener;
let wifi_connection = &mut self.wifi_connection;
let ts = self.timer.now();

let mut a = self.urc_attempts;
let max = self.config.max_urc_attempts;

self.client.try_read_urc_with::<EdmEvent, _>(|edm_urc, _| {

Check warning on line 472 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

the function has a cognitive complexity of (45/25)

warning: the function has a cognitive complexity of (45/25) --> ublox-short-range/src/client.rs:472:54 | 472 | self.client.try_read_urc_with::<EdmEvent, _>(|edm_urc, _| { | ^^^^^^^^^^^^ | = help: you could split it up into multiple smaller functions = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cognitive_complexity = note: `-W clippy::cognitive-complexity` implied by `-W clippy::nursery`
ran = true;
let res = match edm_urc {
EdmEvent::ATEvent(urc) => {
Expand Down Expand Up @@ -516,7 +519,7 @@
new_socket.set_state(UdpState::Established);
if new_socket.bind(remote).is_err(){
error!("[UDP_URC] Binding connecting socket Error");
handled = false

Check warning on line 522 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting --> ublox-short-range/src/client.rs:522:41 | 522 | ... handled = false | ^^^^^^^^^^^^^^^ help: add a `;` here: `handled = false;` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned = note: `-W clippy::semicolon-if-nothing-returned` implied by `-W clippy::pedantic`
}
if sockets.add(new_socket).is_err(){
error!("[UDP_URC] Opening socket Error: Socket set full");
Expand All @@ -533,7 +536,7 @@
socket_handle
);
if queue.enqueue((socket_handle, remote)).is_err(){
handled = false

Check warning on line 539 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting --> ublox-short-range/src/client.rs:539:41 | 539 | ... handled = false | ^^^^^^^^^^^^^^^ help: add a `;` here: `handled = false;` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
}
handled
} else {
Expand All @@ -551,20 +554,20 @@
// return true;
// }
}
IPProtocol::UDP => {
// if let Ok(mut udp) =
// sockets.get::<UdpSocket<TIMER_HZ, L>>(event.handle)
// {
// debug!(
// "Binding remote {=[u8]:a} to UDP socket {:?}",
// event.remote_address.as_slice(),
// event.handle
// );
// udp.bind(remote).unwrap();
// udp.set_state(UdpState::Established);
// return true;
// }
}

Check warning on line 570 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:557:41 | 557 | ... IPProtocol::UDP => { | ^-------------- | | | _______________________help: try merging the arm patterns: `IPProtocol::UDP | IPProtocol::TCP` | | 558 | | ... // if let Ok(mut udp) = 559 | | ... // sockets.get::<UdpSocket<TIMER_HZ, L>>(event.handle) 560 | | ... // { ... | 569 | | ... // } 570 | | ... } | |_______________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:544:41 | 544 | / ... IPProtocol::TCP => { 545 | | ... // if let Ok(mut tcp) = 546 | | ... // sockets.get::<TcpSocket<CLK, L>>(event.handle) 547 | | ... // { ... | 555 | | ... // } 556 | | ... } | |_______________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
}
true
}
Expand Down Expand Up @@ -644,14 +647,14 @@
}
true
}
Urc::WifiAPUp(_) => {
debug!("[URC] WifiAPUp");
true
}

Check warning on line 653 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:650:25 | 650 | Urc::WifiAPUp(_) => { | ^--------------- | | | _________________________help: try merging the arm patterns: `Urc::WifiAPUp(_) | Urc::NetworkError(_)` | | 651 | | debug!("[URC] WifiAPUp"); 652 | | true 653 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:703:25 | 703 | / Urc::NetworkError(_) => { 704 | | debug!("[URC] NetworkError"); 705 | | true 706 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

Check warning on line 653 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:650:25 | 650 | Urc::WifiAPUp(_) => { | ^--------------- | | | _________________________help: try merging the arm patterns: `Urc::WifiAPUp(_) | Urc::EthernetLinkDown(_)` | | 651 | | debug!("[URC] WifiAPUp"); 652 | | true 653 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:673:25 | 673 | / Urc::EthernetLinkDown(_) => { 674 | | debug!("[URC] EthernetLinkDown"); 675 | | true 676 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

Check warning on line 653 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:650:25 | 650 | Urc::WifiAPUp(_) => { | ^--------------- | | | _________________________help: try merging the arm patterns: `Urc::WifiAPUp(_) | Urc::EthernetLinkUp(_)` | | 651 | | debug!("[URC] WifiAPUp"); 652 | | true 653 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:669:25 | 669 | / Urc::EthernetLinkUp(_) => { 670 | | debug!("[URC] EthernetLinkUp"); 671 | | true 672 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

Check warning on line 653 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:650:25 | 650 | Urc::WifiAPUp(_) => { | ^--------------- | | | _________________________help: try merging the arm patterns: `Urc::WifiAPUp(_) | Urc::WifiAPStationDisconnected(_)` | | 651 | | debug!("[URC] WifiAPUp"); 652 | | true 653 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:665:25 | 665 | / Urc::WifiAPStationDisconnected(_) => { 666 | | debug!("[URC] WifiAPStationDisconnected"); 667 | | true 668 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

Check warning on line 653 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:650:25 | 650 | Urc::WifiAPUp(_) => { | ^--------------- | | | _________________________help: try merging the arm patterns: `Urc::WifiAPUp(_) | Urc::WifiAPDown(_)` | | 651 | | debug!("[URC] WifiAPUp"); 652 | | true 653 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:654:25 | 654 | / Urc::WifiAPDown(_) => { 655 | | debug!("[URC] WifiAPDown"); 656 | | true 657 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms = note: `-W clippy::match-same-arms` implied by `-W clippy::pedantic`
Urc::WifiAPDown(_) => {
debug!("[URC] WifiAPDown");
true
}

Check warning on line 657 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:654:25 | 654 | Urc::WifiAPDown(_) => { | ^----------------- | | | _________________________help: try merging the arm patterns: `Urc::WifiAPDown(_) | Urc::NetworkError(_)` | | 655 | | debug!("[URC] WifiAPDown"); 656 | | true 657 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:703:25 | 703 | / Urc::NetworkError(_) => { 704 | | debug!("[URC] NetworkError"); 705 | | true 706 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

Check warning on line 657 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:654:25 | 654 | Urc::WifiAPDown(_) => { | ^----------------- | | | _________________________help: try merging the arm patterns: `Urc::WifiAPDown(_) | Urc::EthernetLinkDown(_)` | | 655 | | debug!("[URC] WifiAPDown"); 656 | | true 657 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:673:25 | 673 | / Urc::EthernetLinkDown(_) => { 674 | | debug!("[URC] EthernetLinkDown"); 675 | | true 676 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

Check warning on line 657 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:654:25 | 654 | Urc::WifiAPDown(_) => { | ^----------------- | | | _________________________help: try merging the arm patterns: `Urc::WifiAPDown(_) | Urc::EthernetLinkUp(_)` | | 655 | | debug!("[URC] WifiAPDown"); 656 | | true 657 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:669:25 | 669 | / Urc::EthernetLinkUp(_) => { 670 | | debug!("[URC] EthernetLinkUp"); 671 | | true 672 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

Check warning on line 657 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:654:25 | 654 | Urc::WifiAPDown(_) => { | ^----------------- | | | _________________________help: try merging the arm patterns: `Urc::WifiAPDown(_) | Urc::WifiAPStationDisconnected(_)` | | 655 | | debug!("[URC] WifiAPDown"); 656 | | true 657 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:665:25 | 665 | / Urc::WifiAPStationDisconnected(_) => { 666 | | debug!("[URC] WifiAPStationDisconnected"); 667 | | true 668 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
Urc::WifiAPStationConnected(client) => {
debug!(
"[URC] WifiAPStationConnected {=[u8]:a}",
Expand All @@ -659,18 +662,18 @@
);
true
}
Urc::WifiAPStationDisconnected(_) => {
debug!("[URC] WifiAPStationDisconnected");
true
}

Check warning on line 668 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:665:25 | 665 | Urc::WifiAPStationDisconnected(_) => { | ^-------------------------------- | | | _________________________help: try merging the arm patterns: `Urc::WifiAPStationDisconnected(_) | Urc::NetworkError(_)` | | 666 | | debug!("[URC] WifiAPStationDisconnected"); 667 | | true 668 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:703:25 | 703 | / Urc::NetworkError(_) => { 704 | | debug!("[URC] NetworkError"); 705 | | true 706 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

Check warning on line 668 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:665:25 | 665 | Urc::WifiAPStationDisconnected(_) => { | ^-------------------------------- | | | _________________________help: try merging the arm patterns: `Urc::WifiAPStationDisconnected(_) | Urc::EthernetLinkDown(_)` | | 666 | | debug!("[URC] WifiAPStationDisconnected"); 667 | | true 668 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:673:25 | 673 | / Urc::EthernetLinkDown(_) => { 674 | | debug!("[URC] EthernetLinkDown"); 675 | | true 676 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

Check warning on line 668 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:665:25 | 665 | Urc::WifiAPStationDisconnected(_) => { | ^-------------------------------- | | | _________________________help: try merging the arm patterns: `Urc::WifiAPStationDisconnected(_) | Urc::EthernetLinkUp(_)` | | 666 | | debug!("[URC] WifiAPStationDisconnected"); 667 | | true 668 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:669:25 | 669 | / Urc::EthernetLinkUp(_) => { 670 | | debug!("[URC] EthernetLinkUp"); 671 | | true 672 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
Urc::EthernetLinkUp(_) => {
debug!("[URC] EthernetLinkUp");
true
}

Check warning on line 672 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:669:25 | 669 | Urc::EthernetLinkUp(_) => { | ^--------------------- | | | _________________________help: try merging the arm patterns: `Urc::EthernetLinkUp(_) | Urc::NetworkError(_)` | | 670 | | debug!("[URC] EthernetLinkUp"); 671 | | true 672 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:703:25 | 703 | / Urc::NetworkError(_) => { 704 | | debug!("[URC] NetworkError"); 705 | | true 706 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

Check warning on line 672 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:669:25 | 669 | Urc::EthernetLinkUp(_) => { | ^--------------------- | | | _________________________help: try merging the arm patterns: `Urc::EthernetLinkUp(_) | Urc::EthernetLinkDown(_)` | | 670 | | debug!("[URC] EthernetLinkUp"); 671 | | true 672 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:673:25 | 673 | / Urc::EthernetLinkDown(_) => { 674 | | debug!("[URC] EthernetLinkDown"); 675 | | true 676 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
Urc::EthernetLinkDown(_) => {
debug!("[URC] EthernetLinkDown");
true
}

Check warning on line 676 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm --> ublox-short-range/src/client.rs:673:25 | 673 | Urc::EthernetLinkDown(_) => { | ^----------------------- | | | _________________________help: try merging the arm patterns: `Urc::EthernetLinkDown(_) | Urc::NetworkError(_)` | | 674 | | debug!("[URC] EthernetLinkDown"); 675 | | true 676 | | } | |_________________________^ | = help: or try changing either arm body note: other arm here --> ublox-short-range/src/client.rs:703:25 | 703 | / Urc::NetworkError(_) => { 704 | | debug!("[URC] NetworkError"); 705 | | true 706 | | } | |_________________________^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
Urc::NetworkUp(_) => {
debug!("[URC] NetworkUp");
if let Some(con) = wifi_connection {
Expand All @@ -678,10 +681,10 @@
match con.network_state {
NetworkState::Attached => (),
NetworkState::AlmostAttached => {
con.network_state = NetworkState::Attached

Check warning on line 684 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting --> ublox-short-range/src/client.rs:684:45 | 684 | ... con.network_state = NetworkState::Attached | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `con.network_state = NetworkState::Attached;` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
}
NetworkState::Unattached => {
con.network_state = NetworkState::AlmostAttached

Check warning on line 687 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting --> ublox-short-range/src/client.rs:687:45 | 687 | ... con.network_state = NetworkState::AlmostAttached | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `con.network_state = NetworkState::AlmostAttached;` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
}
}
} else {
Expand Down Expand Up @@ -755,7 +758,7 @@
return Some(true);
}
}
_ => {}

Check warning on line 761 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

wildcard matches only a single variant and will also match any future added variants

warning: wildcard matches only a single variant and will also match any future added variants --> ublox-short-range/src/client.rs:761:41 | 761 | ... _ => {} | ^ help: try this: `Protocol::Unknown` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants = note: `-W clippy::match-wildcard-for-single-variants` implied by `-W clippy::pedantic`
}
None
})
Expand Down Expand Up @@ -802,7 +805,7 @@
return Some(true);
}
}
_ => {}

Check warning on line 808 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

wildcard matches only a single variant and will also match any future added variants

warning: wildcard matches only a single variant and will also match any future added variants --> ublox-short-range/src/client.rs:808:41 | 808 | ... _ => {} | ^ help: try this: `Protocol::Unknown` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants
}
None
})
Expand All @@ -824,47 +827,47 @@
EdmEvent::DataEvent(event) => {
debug!("[EDM_URC] DataEvent! Channel_id: {:?}", event.channel_id);
if let Some(sockets) = socket_set {
if !event.data.is_empty() {
if let Some(socket_handle) =
socket_map.channel_to_socket(&event.channel_id)
{
match sockets.socket_type(*socket_handle) {
Some(SocketType::Tcp) => {
// Handle tcp socket
let mut tcp = sockets
.get::<TcpSocket<TIMER_HZ, L>>(*socket_handle)
.unwrap();
if tcp.can_recv() {
tcp.rx_enqueue_slice(&event.data);
true
} else {
false
}
}
Some(SocketType::Udp) => {
// Handle udp socket
let mut udp = sockets
.get::<UdpSocket<TIMER_HZ, L>>(*socket_handle)
.unwrap();

if udp.can_recv() {
udp.rx_enqueue_slice(&event.data);
true
} else {
false
}
}
_ => {
error!("SocketNotFound {:?}", socket_handle);
false
}
}
} else {
false
}
} else {
false
}

Check warning on line 870 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

unnecessary boolean `not` operation

warning: unnecessary boolean `not` operation --> ublox-short-range/src/client.rs:830:25 | 830 | / if !event.data.is_empty() { 831 | | if let Some(socket_handle) = 832 | | socket_map.channel_to_socket(&event.channel_id) 833 | | { ... | 869 | | false 870 | | } | |_________________________^ | = help: remove the `!` and swap the blocks of the `if`/`else` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else = note: `-W clippy::if-not-else` implied by `-W clippy::pedantic`
} else {
true
}
Expand All @@ -887,9 +890,9 @@

/// Send AT command
/// Automaticaly waraps commands in EDM context
pub fn send_at<A, const LEN: usize>(&mut self, cmd: A) -> Result<A::Response, Error>
where
A: atat::AtatCmd<LEN>,

Check warning on line 895 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section --> ublox-short-range/src/client.rs:893:5 | 893 | / pub fn send_at<A, const LEN: usize>(&mut self, cmd: A) -> Result<A::Response, Error> 894 | | where 895 | | A: atat::AtatCmd<LEN>, | |______________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
{
if !self.initialized {
self.init()?;
Expand All @@ -900,7 +903,7 @@
}
}

pub fn supplicant<const M: usize>(&mut self) -> Result<Supplicant<C, M>, Error> {

Check warning on line 906 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section --> ublox-short-range/src/client.rs:906:5 | 906 | pub fn supplicant<const M: usize>(&mut self) -> Result<Supplicant<C, M>, Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
// TODO: better solution
if !self.initialized {
return Err(Error::Uninitialized);
Expand All @@ -912,44 +915,44 @@
active_on_startup: &mut self.wifi_config_active_on_startup,
})
}
/// Is the module attached to a WiFi and ready to open sockets

Check warning on line 918 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

item in documentation is missing backticks

warning: item in documentation is missing backticks --> ublox-short-range/src/client.rs:918:37 | 918 | /// Is the module attached to a WiFi and ready to open sockets | ^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown = note: `-W clippy::doc-markdown` implied by `-W clippy::pedantic` help: try | 918 | /// Is the module attached to a `WiFi` and ready to open sockets | ~~~~~~
pub fn connected_to_network(&self) -> Result<(), Error> {

Check warning on line 919 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section --> ublox-short-range/src/client.rs:919:5 | 919 | pub fn connected_to_network(&self) -> Result<(), Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
if let Some(ref con) = self.wifi_connection {
if !self.initialized {
Err(Error::Uninitialized)
} else if !con.is_connected() {
Err(Error::WifiState(con.wifi_state))
} else if self.sockets.is_none() {
Err(Error::MissingSocketSet)
} else {
Ok(())
}
} else {
Err(Error::NoWifiSetup)
}

Check warning on line 932 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

use Option::map_or instead of an if let/else

warning: use Option::map_or instead of an if let/else --> ublox-short-range/src/client.rs:920:9 | 920 | / if let Some(ref con) = self.wifi_connection { 921 | | if !self.initialized { 922 | | Err(Error::Uninitialized) 923 | | } else if !con.is_connected() { ... | 931 | | Err(Error::NoWifiSetup) 932 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else help: try | 920 ~ self.wifi_connection.as_ref().map_or(Err(Error::NoWifiSetup), |con| if !self.initialized { 921 + Err(Error::Uninitialized) 922 + } else if !con.is_connected() { 923 + Err(Error::WifiState(con.wifi_state)) 924 + } else if self.sockets.is_none() { 925 + Err(Error::MissingSocketSet) 926 + } else { 927 + Ok(()) 928 + }) |
}

/// Is the module attached to a WiFi

Check warning on line 935 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

item in documentation is missing backticks

warning: item in documentation is missing backticks --> ublox-short-range/src/client.rs:935:37 | 935 | /// Is the module attached to a WiFi | ^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown help: try | 935 | /// Is the module attached to a `WiFi` | ~~~~~~
///
// TODO: handle this case for better stability
// WiFi connection can disconnect momentarily, but if the network state does not change
// the current context is safe.
pub fn attached_to_wifi(&self) -> Result<(), Error> {

Check warning on line 940 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section --> ublox-short-range/src/client.rs:940:5 | 940 | pub fn attached_to_wifi(&self) -> Result<(), Error> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
if let Some(ref con) = self.wifi_connection {
if !self.initialized {
Err(Error::Uninitialized)
// } else if !(con.network_state == NetworkState::Attached) {
} else if !con.is_connected() {
if con.wifi_state == WiFiState::Connected {
Err(Error::NetworkState(con.network_state))
} else {
Err(Error::WifiState(con.wifi_state))
}
} else {
Ok(())
}
} else {
Err(Error::NoWifiSetup)
}

Check warning on line 956 in ublox-short-range/src/client.rs

View workflow job for this annotation

GitHub Actions / clippy

use Option::map_or instead of an if let/else

warning: use Option::map_or instead of an if let/else --> ublox-short-range/src/client.rs:941:9 | 941 | / if let Some(ref con) = self.wifi_connection { 942 | | if !self.initialized { 943 | | Err(Error::Uninitialized) 944 | | // } else if !(con.network_state == NetworkState::Attached) { ... | 955 | | Err(Error::NoWifiSetup) 956 | | } | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else help: try | 941 ~ self.wifi_connection.as_ref().map_or(Err(Error::NoWifiSetup), |con| if !self.initialized { 942 + Err(Error::Uninitialized) 943 + // } else if !(con.network_state == NetworkState::Attached) { 944 + } else if !con.is_connected() { 945 + if con.wifi_state == WiFiState::Connected { 946 + Err(Error::NetworkState(con.network_state)) 947 + } else { 948 + Err(Error::WifiState(con.wifi_state)) 949 + } 950 + } else { 951 + Ok(()) 952 + }) |
}
}
Loading