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 embassy-sync to 0.6 #206

Merged
merged 1 commit into from
Jun 11, 2024
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 atat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ name = "atat"
embedded-io = "0.6.0"
embedded-io-async = "0.6.0"
futures = { version = "0.3", default-features = false }
embassy-sync = "0.5"
embassy-sync = "0.6"
embassy-time = "0.3"
heapless = { version = "^0.8", features = ["serde"] }
serde_at = { path = "../serde_at", version = "^0.22.0", optional = true }
Expand Down
6 changes: 3 additions & 3 deletions atat/src/ingress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
UrcChannel,
};

#[derive(Debug, PartialEq)]

Check warning on line 6 in atat/src/ingress.rs

View workflow job for this annotation

GitHub Actions / clippy

you are deriving `PartialEq` and can implement `Eq`

warning: you are deriving `PartialEq` and can implement `Eq` --> atat/src/ingress.rs:6:17 | 6 | #[derive(Debug, PartialEq)] | ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq = note: `-W clippy::derive-partial-eq-without-eq` implied by `-W clippy::nursery` = help: to override `-W clippy::nursery` add `#[allow(clippy::derive_partial_eq_without_eq)]`
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Error {
ResponseSlotBusy,
Expand Down Expand Up @@ -54,7 +54,7 @@

/// Read all bytes from the provided serial and ingest the read bytes into
/// the ingress from where they will be processed
async fn read_from(&mut self, serial: &mut impl embedded_io_async::Read) -> ! {
async fn read_from<R: embedded_io_async::Read>(&mut self, mut serial: R) -> ! {
use embedded_io::Error;
loop {
let buf = self.write_buf();
Expand Down Expand Up @@ -99,12 +99,12 @@
const URC_SUBSCRIBERS: usize,
> Ingress<'a, D, Urc, RES_BUF_SIZE, URC_CAPACITY, URC_SUBSCRIBERS>
{
pub fn new(
digester: D,
buf: &'a mut [u8],
res_slot: &'a ResponseSlot<RES_BUF_SIZE>,
urc_channel: &'a UrcChannel<Urc, URC_CAPACITY, URC_SUBSCRIBERS>,
) -> Self {

Check warning on line 107 in atat/src/ingress.rs

View workflow job for this annotation

GitHub Actions / clippy

docs for function which may panic missing `# Panics` section

warning: docs for function which may panic missing `# Panics` section --> atat/src/ingress.rs:102:5 | 102 | / pub fn new( 103 | | digester: D, 104 | | buf: &'a mut [u8], 105 | | res_slot: &'a ResponseSlot<RES_BUF_SIZE>, 106 | | urc_channel: &'a UrcChannel<Urc, URC_CAPACITY, URC_SUBSCRIBERS>, 107 | | ) -> Self { | |_____________^ | note: first possible panic found here --> atat/src/ingress.rs:113:28 | 113 | urc_publisher: urc_channel.0.publisher().unwrap(), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc = note: `-W clippy::missing-panics-doc` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::missing_panics_doc)]`
Self {
digester,
buf,
Expand Down Expand Up @@ -158,7 +158,7 @@
if let Some(urc) = Urc::parse(urc_line) {
debug!(
"Received URC/{} ({}/{}): {:?}",
self.urc_publisher.space(),
self.urc_publisher.free_capacity(),
swallowed,
self.pos,
LossyStr(urc_line)
Expand All @@ -176,7 +176,7 @@
match &resp {
Ok(r) => {
if r.is_empty() {
debug!("Received OK ({}/{})", swallowed, self.pos,)

Check warning on line 179 in atat/src/ingress.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 --> atat/src/ingress.rs:179:33 | 179 | ... debug!("Received OK ({}/{})", swallowed, self.pos,) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `debug!("Received OK ({}/{})", swallowed, self.pos,);` | = 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` = help: to override `-W clippy::pedantic` add `#[allow(clippy::semicolon_if_nothing_returned)]`
} else {
debug!(
"Received response ({}/{}): {:?}",
Expand Down Expand Up @@ -212,7 +212,7 @@
Ok(())
}

async fn advance(&mut self, commit: usize) {

Check warning on line 215 in atat/src/ingress.rs

View workflow job for this annotation

GitHub Actions / clippy

future cannot be sent between threads safely

warning: future cannot be sent between threads safely --> atat/src/ingress.rs:215:5 | 215 | async fn advance(&mut self, commit: usize) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `advance` is not `Send` | note: future is not `Send` as this value is used across an await --> atat/src/ingress.rs:252:61 | 242 | if let Some(urc) = Urc::parse(urc_line) { | -------------------- has type `core::option::Option<<Urc as traits::AtatUrc>::Response>` which is not `Send` ... 252 | self.urc_publisher.publish(urc).await; | ^^^^^ await occurs here, with `Urc::parse(urc_line)` maybe used later = note: `<Urc as traits::AtatUrc>::Response` doesn't implement `core::marker::Send` note: future is not `Send` as this value is used across an await --> atat/src/ingress.rs:252:61 | 215 | async fn advance(&mut self, commit: usize) { | --------- has type `&mut ingress::Ingress<'_, D, Urc, RES_BUF_SIZE, URC_CAPACITY, URC_SUBSCRIBERS>` which is not `Send` ... 252 | self.urc_publisher.publish(urc).await; | ^^^^^ await occurs here, with `&mut self` maybe used later = note: `D` doesn't implement `core::marker::Send` note: future is not `Send` as it awaits another future which is not `Send` --> atat/src/ingress.rs:252:29 | 252 | ... self.urc_publisher.publish(urc).await; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here on type `embassy_sync::pubsub::publisher::PublisherWaitFuture<'_, '_, embassy_sync::pubsub::PubSubChannel<embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex, <Urc as traits::AtatUrc>::Response, URC_CAPACITY, URC_SUBSCRIBERS, 1>, <Urc as traits::AtatUrc>::Response>`, which is not `Send` = note: `<Urc as traits::AtatUrc>::Response` doesn't implement `core::marker::Sync` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#future_not_send = note: `-W clippy::future-not-send` implied by `-W clippy::nursery` = help: to override `-W clippy::nursery` add `#[allow(clippy::future_not_send)]`
self.pos += commit;
assert!(self.pos <= self.buf.len());

Expand Down Expand Up @@ -242,7 +242,7 @@
if let Some(urc) = Urc::parse(urc_line) {
debug!(
"Received URC/{} ({}/{}): {:?}",
self.urc_publisher.space(),
self.urc_publisher.free_capacity(),
swallowed,
self.pos,
LossyStr(urc_line)
Expand All @@ -260,7 +260,7 @@
match &resp {
Ok(r) => {
if r.is_empty() {
debug!("Received OK ({}/{})", swallowed, self.pos,)

Check warning on line 263 in atat/src/ingress.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 --> atat/src/ingress.rs:263:33 | 263 | ... debug!("Received OK ({}/{})", swallowed, self.pos,) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `debug!("Received OK ({}/{})", swallowed, self.pos,);` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
} else {
debug!(
"Received response ({}/{}): {:?}",
Expand Down
6 changes: 3 additions & 3 deletions atat/src/urc_channel.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
use embassy_sync::pubsub::{PubSubBehavior, PubSubChannel, Publisher, Subscriber};
use embassy_sync::pubsub::{PubSubChannel, Publisher, Subscriber};

use crate::AtatUrc;

Expand All @@ -21,9 +21,9 @@
impl<Urc: AtatUrc, const CAPACITY: usize, const SUBSCRIBERS: usize>
UrcChannel<Urc, CAPACITY, SUBSCRIBERS>
{
pub const fn new() -> Self {

Check warning on line 24 in atat/src/urc_channel.rs

View workflow job for this annotation

GitHub Actions / clippy

this method could have a `#[must_use]` attribute

warning: this method could have a `#[must_use]` attribute --> atat/src/urc_channel.rs:24:5 | 24 | pub const fn new() -> Self { | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub const fn new() -> Self` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
Self(PubSubChannel::new())
}

Check warning on line 26 in atat/src/urc_channel.rs

View workflow job for this annotation

GitHub Actions / clippy

you should consider adding a `Default` implementation for `UrcChannel<Urc, CAPACITY, SUBSCRIBERS>`

warning: you should consider adding a `Default` implementation for `UrcChannel<Urc, CAPACITY, SUBSCRIBERS>` --> atat/src/urc_channel.rs:24:5 | 24 | / pub const fn new() -> Self { 25 | | Self(PubSubChannel::new()) 26 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default help: try adding this | 21 + impl<Urc: AtatUrc, const CAPACITY: usize, const SUBSCRIBERS: usize> Default for UrcChannel<Urc, CAPACITY, SUBSCRIBERS> { 22 + fn default() -> Self { 23 + Self::new() 24 + } 25 + } |

pub fn subscribe(&self) -> Result<UrcSubscription<'_, Urc, CAPACITY, SUBSCRIBERS>, Error> {
self.0
Expand All @@ -31,7 +31,7 @@
.map_err(|_| Error::MaximumSubscribersReached)
}

pub fn space(&self) -> usize {
self.0.space()
pub fn free_capacity(&self) -> usize {
self.0.free_capacity()
}
}
Loading