Skip to content

Commit 0a92676

Browse files
authored
Merge pull request #1083 from HaoboGu/main
Bump `heapless` version to v0.9
2 parents 5cbb9f2 + f04523a commit 0a92676

27 files changed

+39
-47
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "smoltcp"
33
version = "0.12.0"
44
edition = "2021"
5-
rust-version = "1.81"
5+
rust-version = "1.87"
66
authors = ["whitequark <whitequark@whitequark.org>"]
77
description = "A TCP/IP stack designed for bare-metal, real-time systems without a heap."
88
documentation = "https://docs.rs/smoltcp/"
@@ -27,7 +27,7 @@ libc = { version = "0.2.18", optional = true }
2727
bitflags = { version = "1.0", default-features = false }
2828
defmt = { version = "0.3.8", optional = true, features = ["ip_in_core"] }
2929
cfg-if = "1.0.0"
30-
heapless = "0.8"
30+
heapless = "0.9"
3131

3232
[dev-dependencies]
3333
env_logger = "0.10"
@@ -43,7 +43,7 @@ idna = { version = "=1.0.1" }
4343
std = ["managed/std", "alloc"]
4444
alloc = ["managed/alloc", "defmt?/alloc"]
4545
verbose = []
46-
defmt = ["dep:defmt", "heapless/defmt-03"]
46+
defmt = ["dep:defmt", "heapless/defmt"]
4747
"medium-ethernet" = ["socket"]
4848
"medium-ip" = ["socket"]
4949
"medium-ieee802154" = ["socket", "proto-sixlowpan"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ include complicated compile-time computations, such as macro or type tricks, eve
1212
at cost of performance degradation.
1313

1414
_smoltcp_ does not need heap allocation *at all*, is [extensively documented][docs],
15-
and compiles on stable Rust 1.81 and later.
15+
and compiles on stable Rust 1.87 and later.
1616

1717
_smoltcp_ achieves [~Gbps of throughput](#examplesbenchmarkrs) when tested against
1818
the Linux TCP stack in loopback mode.

ci.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eox pipefail
44

55
export DEFMT_LOG=trace
66

7-
MSRV="1.81.0"
7+
MSRV="1.87.0"
88

99
RUSTC_VERSIONS=(
1010
$MSRV

src/iface/interface/ipv4.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,7 @@ impl InterfaceInner {
126126
// NOTE: according to the standard, the total length needs to be
127127
// recomputed, as well as the checksum. However, we don't really use
128128
// the IPv4 header after the packet is reassembled.
129-
match f.assemble() {
130-
Some(payload) => payload,
131-
None => return None,
132-
}
129+
f.assemble()?
133130
} else {
134131
ipv4_packet.payload()
135132
}
@@ -198,7 +195,7 @@ impl InterfaceInner {
198195
if self
199196
.routes
200197
.lookup(&IpAddress::Ipv4(ipv4_repr.dst_addr), self.now)
201-
.map_or(true, |router_addr| !self.has_ip_addr(router_addr))
198+
.is_none_or(|router_addr| !self.has_ip_addr(router_addr))
202199
{
203200
net_trace!("Rejecting IPv4 packet; no matching routes");
204201

src/iface/interface/ipv6.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl InterfaceInner {
228228
if self
229229
.routes
230230
.lookup(&IpAddress::Ipv6(ipv6_repr.dst_addr), self.now)
231-
.map_or(true, |router_addr| !self.has_ip_addr(router_addr))
231+
.is_none_or(|router_addr| !self.has_ip_addr(router_addr))
232232
{
233233
net_trace!("Rejecting IPv6 packet; no matching routes");
234234

src/iface/interface/sixlowpan.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,7 @@ impl InterfaceInner {
6868
}
6969
#[cfg(feature = "proto-sixlowpan-fragmentation")]
7070
SixlowpanPacket::FragmentHeader => {
71-
match self.process_sixlowpan_fragment(ieee802154_repr, payload, f) {
72-
Some(payload) => payload,
73-
None => return None,
74-
}
71+
self.process_sixlowpan_fragment(ieee802154_repr, payload, f)?
7572
}
7673
SixlowpanPacket::IphcHeader => {
7774
match Self::sixlowpan_to_ipv6(

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
//!
6666
//! # Minimum Supported Rust Version (MSRV)
6767
//!
68-
//! This crate is guaranteed to compile on stable Rust 1.81 and up with any valid set of features.
68+
//! This crate is guaranteed to compile on stable Rust 1.87 and up with any valid set of features.
6969
//! It *might* compile on older versions but that may change in any new patch release.
7070
//!
7171
//! The exception is when using the `defmt` feature, in which case `defmt`'s MSRV applies, which

src/phy/sys/tuntap_interface.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ impl AsRawFd for TunTapInterfaceDesc {
1818
impl TunTapInterfaceDesc {
1919
pub fn new(name: &str, medium: Medium) -> io::Result<TunTapInterfaceDesc> {
2020
let lower = unsafe {
21-
let lower = libc::open(
22-
"/dev/net/tun\0".as_ptr() as *const libc::c_char,
23-
libc::O_RDWR | libc::O_NONBLOCK,
24-
);
21+
let lower = libc::open(c"/dev/net/tun".as_ptr(), libc::O_RDWR | libc::O_NONBLOCK);
2522
if lower == -1 {
2623
return Err(io::Error::last_os_error());
2724
}

src/socket/dhcpv4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ impl<'a> Socket<'a> {
743743
///
744744
/// The socket has an internal "configuration changed" flag. If
745745
/// set, this function returns the configuration and resets the flag.
746-
pub fn poll(&mut self) -> Option<Event> {
746+
pub fn poll(&mut self) -> Option<Event<'_>> {
747747
if !self.config_changed {
748748
None
749749
} else if let ClientState::Renewing(state) = &self.state {

src/socket/dns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ impl<'a> Socket<'a> {
248248

249249
let mut mdns = MulticastDns::Disabled;
250250
#[cfg(feature = "socket-mdns")]
251-
if name.split(|&c| c == b'.').last().unwrap() == b"local" {
251+
if name.split(|&c| c == b'.').next_back().unwrap() == b"local" {
252252
net_trace!("Starting a mDNS query");
253253
mdns = MulticastDns::Enabled;
254254
}

0 commit comments

Comments
 (0)