Skip to content

Commit

Permalink
Merge pull request #95 from Dirbaio/remove-bound
Browse files Browse the repository at this point in the history
Remove unneeded `where Self: 'a` bound in `TcpClient::connect`.
  • Loading branch information
ryan-summers authored Nov 9, 2023
2 parents 65ba5a3 + 43448d1 commit 71fa123
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
rust: [nightly-2022-11-22]
rust: [nightly-2023-11-01]
TARGET:
[x86_64-unknown-linux-gnu, thumbv6m-none-eabi, thumbv7m-none-eabi]

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: [ staging, trying, master ]
branches: [staging, trying, master]
pull_request:

name: Code formatting check
Expand All @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2022-11-22
toolchain: nightly-2023-11-01
components: rustfmt
- run: cargo fmt --all -- --check
working-directory: embedded-nal-async
1 change: 1 addition & 0 deletions embedded-nal-async/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]

- [breaking] `Dns::get_host_by_address` now uses `&mut [u8]` instead of `heapless::String`.
- [breaking] Remove unneeded `where Self: 'a` bound in `TcpClient::connect`.

## [0.6.0] - 2023-10-03

Expand Down
14 changes: 6 additions & 8 deletions embedded-nal-async/src/stack/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,19 @@ pub trait TcpConnect {
/// Connect to the given remote host and port.
///
/// Returns `Ok` if the connection was successful.
async fn connect<'a>(&'a self, remote: SocketAddr) -> Result<Self::Connection<'a>, Self::Error>
// This bound is required due to an AFIT limitaton: https://github.com/rust-lang/rust/issues/104908
where
Self: 'a;
async fn connect<'a>(&'a self, remote: SocketAddr)
-> Result<Self::Connection<'a>, Self::Error>;
}

impl<T: TcpConnect> TcpConnect for &T {
type Error = T::Error;

type Connection<'a> = T::Connection<'a> where Self: 'a;

async fn connect<'a>(&'a self, remote: SocketAddr) -> Result<Self::Connection<'a>, Self::Error>
where
Self: 'a,
{
async fn connect<'a>(
&'a self,
remote: SocketAddr,
) -> Result<Self::Connection<'a>, Self::Error> {
T::connect(self, remote).await
}
}

0 comments on commit 71fa123

Please sign in to comment.