Skip to content

Commit

Permalink
Use anonymous lifetime where no reference to it is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
zargony committed Nov 26, 2024
1 parent 331f10e commit ea45b09
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions firmware/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub struct Http<'a> {
client: HttpClient<'a, TcpClient<'a>, DnsSocket<'a>>,
}

impl<'a> fmt::Debug for Http<'a> {
impl fmt::Debug for Http<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Http").finish()
}
Expand Down Expand Up @@ -120,7 +120,7 @@ pub struct Connection<'a> {
resource: HttpResource<'a, TcpConnection<'a>>,
}

impl<'a> fmt::Debug for Connection<'a> {
impl fmt::Debug for Connection<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Connection")
.field("host", &self.resource.host)
Expand Down Expand Up @@ -199,7 +199,7 @@ impl<'a> Connection<'a> {
}
}

impl<'a> Connection<'a> {
impl Connection<'_> {
/// Send request, check response status and return response body JSON reader
async fn send_request<'req, 'conn, B: RequestBody>(
request: HttpResourceRequestBuilder<'req, 'conn, TcpConnection<'conn>, B>,
Expand Down
6 changes: 3 additions & 3 deletions firmware/src/keypad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl<'a, const COLS: usize, const ROWS: usize> Keypad<'a, COLS, ROWS> {
}
}

impl<'a, const COLS: usize, const ROWS: usize> Keypad<'a, COLS, ROWS> {
impl<const COLS: usize, const ROWS: usize> Keypad<'_, COLS, ROWS> {
/// Wait for any key to be pressed
async fn wait_for_keypress(&mut self) {
// Assuming inputs have pull up resistors, so keys will pull low when pressed
Expand Down Expand Up @@ -119,7 +119,7 @@ impl<'a, const COLS: usize, const ROWS: usize> Keypad<'a, COLS, ROWS> {
}
}

impl<'a> Keypad<'a, 3, 4> {
impl Keypad<'_, 3, 4> {
// 1 2 3
// 4 5 6
// 7 8 9
Expand Down Expand Up @@ -149,7 +149,7 @@ impl<'a> Keypad<'a, 3, 4> {
}

#[allow(dead_code)]
impl<'a> Keypad<'a, 4, 4> {
impl Keypad<'_, 4, 4> {
// 1 2 3 A
// 4 5 6 B
// 7 8 9 C
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl<'a> NumberOfDrinks<'a> {
}
}

impl<'a> Screen for NumberOfDrinks<'a> {
impl Screen for NumberOfDrinks<'_> {
fn draw<D: DrawTarget<Color = BinaryColor>>(
&self,
target: &mut D,
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl<'a, RNG: RngCore, I2C: I2c, IRQ: Wait<Error = Infallible>> Ui<'a, RNG, I2C,
}
}

impl<'a, RNG: RngCore, I2C: I2c, IRQ: Wait<Error = Infallible>> Ui<'a, RNG, I2C, IRQ> {
impl<RNG: RngCore, I2C: I2c, IRQ: Wait<Error = Infallible>> Ui<'_, RNG, I2C, IRQ> {
/// Authentication: wait for id card, read it and look up the associated user. On idle timeout,
/// enter power saving (turn off display). Any key pressed leaves power saving (turn on
/// display).
Expand Down
6 changes: 3 additions & 3 deletions firmware/src/vereinsflieger/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub struct Vereinsflieger<'a> {
accesstoken: Option<AccessToken>,
}

impl<'a> fmt::Debug for Vereinsflieger<'a> {
impl fmt::Debug for Vereinsflieger<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Vereinsflieger")
.field("http", &self.http)
Expand Down Expand Up @@ -98,7 +98,7 @@ pub struct Connection<'a> {
accesstoken: &'a AccessToken,
}

impl<'a> fmt::Debug for Connection<'a> {
impl fmt::Debug for Connection<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Connection")
.field("connection", &self.connection)
Expand All @@ -107,7 +107,7 @@ impl<'a> fmt::Debug for Connection<'a> {
}
}

impl<'a> Connection<'a> {
impl Connection<'_> {
/// Fetch information about authenticated user
#[allow(dead_code)]
pub async fn get_user_information(&mut self) -> Result<(), Error> {
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/vereinsflieger/proto_articles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct ArticleListRequest<'a> {
pub accesstoken: &'a AccessToken,
}

impl<'a> ToJson for ArticleListRequest<'a> {
impl ToJson for ArticleListRequest<'_> {
async fn to_json<W: Write>(
&self,
json: &mut json::Writer<W>,
Expand Down
4 changes: 2 additions & 2 deletions firmware/src/vereinsflieger/proto_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct SignInRequest<'a> {
pub auth_secret: Option<&'a str>,
}

impl<'a> ToJson for SignInRequest<'a> {
impl ToJson for SignInRequest<'_> {
async fn to_json<W: Write>(
&self,
json: &mut json::Writer<W>,
Expand Down Expand Up @@ -91,7 +91,7 @@ pub struct UserInformationRequest<'a> {
pub accesstoken: &'a AccessToken,
}

impl<'a> ToJson for UserInformationRequest<'a> {
impl ToJson for UserInformationRequest<'_> {
async fn to_json<W: Write>(
&self,
json: &mut json::Writer<W>,
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/vereinsflieger/proto_sale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct SaleAddRequest<'a> {
// pub caid2: Option<u32>,
}

impl<'a> ToJson for SaleAddRequest<'a> {
impl ToJson for SaleAddRequest<'_> {
async fn to_json<W: Write>(
&self,
json: &mut json::Writer<W>,
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/vereinsflieger/proto_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct UserListRequest<'a> {
pub accesstoken: &'a AccessToken,
}

impl<'a> ToJson for UserListRequest<'a> {
impl ToJson for UserListRequest<'_> {
async fn to_json<W: Write>(
&self,
json: &mut json::Writer<W>,
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/wifi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<T: fmt::Display> fmt::Display for DisplayOption<T> {
/// List display helper
struct DisplayList<'a, T: fmt::Display>(&'a [T]);

impl<'a, T: fmt::Display> fmt::Display for DisplayList<'a, T> {
impl<T: fmt::Display> fmt::Display for DisplayList<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.0.is_empty() {
write!(f, "-")?;
Expand Down

0 comments on commit ea45b09

Please sign in to comment.