Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/cargo/stun-0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jxs committed May 8, 2024
2 parents 41b3f82 + 910bf76 commit 3926bc9
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 25 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
with:
fetch-depth: 0

- uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0
- uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0

- uses: dtolnay/rust-toolchain@stable

Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
with:
target: ${{ matrix.target }}

- uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0
- uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0

- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
Expand All @@ -181,7 +181,7 @@ jobs:
with:
toolchain: ${{ env.MSRV }}

- uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0
- uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0

- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
Expand All @@ -202,7 +202,7 @@ jobs:

- uses: dtolnay/rust-toolchain@stable

- uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0
- uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0

- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
Expand All @@ -219,7 +219,7 @@ jobs:

- uses: dtolnay/rust-toolchain@stable

- uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0
- uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0

- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
Expand All @@ -234,7 +234,7 @@ jobs:
fail-fast: false
matrix:
rust-version: [
1.77.0, # current stable
1.78.0, # current stable
beta,
]
steps:
Expand All @@ -245,7 +245,7 @@ jobs:
toolchain: ${{ matrix.rust-version }}
components: clippy

- uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0
- uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0

- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
Expand All @@ -261,7 +261,7 @@ jobs:

- uses: dtolnay/rust-toolchain@stable

- uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0
- uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0

- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
Expand All @@ -280,7 +280,7 @@ jobs:

- uses: dtolnay/rust-toolchain@stable

- uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0
- uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0

- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
Expand Down Expand Up @@ -330,7 +330,7 @@ jobs:
with:
components: rustfmt

- uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0
- uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0

- name: Check formatting
run: cargo fmt -- --check
Expand All @@ -342,7 +342,7 @@ jobs:

- uses: dtolnay/rust-toolchain@stable

- uses: r7kamura/rust-problem-matchers@2c2f1016021a7455a6b5b4bbae31145f3b3cd83a #v1.4.0
- uses: r7kamura/rust-problem-matchers@9fe7ca9f6550e5d6358e179d451cc25ea6b54f98 #v1.5.0

- name: Ensure `full` feature contains all features
run: |
Expand Down
8 changes: 4 additions & 4 deletions libp2p/src/bandwidth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl<SMInner: AsyncRead> AsyncRead for InstrumentedStream<SMInner> {
let this = self.project();
let num_bytes = ready!(this.inner.poll_read(cx, buf))?;
this.sinks.inbound.fetch_add(
u64::try_from(num_bytes).unwrap_or(u64::max_value()),
u64::try_from(num_bytes).unwrap_or(u64::MAX),
Ordering::Relaxed,
);
Poll::Ready(Ok(num_bytes))
Expand All @@ -168,7 +168,7 @@ impl<SMInner: AsyncRead> AsyncRead for InstrumentedStream<SMInner> {
let this = self.project();
let num_bytes = ready!(this.inner.poll_read_vectored(cx, bufs))?;
this.sinks.inbound.fetch_add(
u64::try_from(num_bytes).unwrap_or(u64::max_value()),
u64::try_from(num_bytes).unwrap_or(u64::MAX),
Ordering::Relaxed,
);
Poll::Ready(Ok(num_bytes))
Expand All @@ -184,7 +184,7 @@ impl<SMInner: AsyncWrite> AsyncWrite for InstrumentedStream<SMInner> {
let this = self.project();
let num_bytes = ready!(this.inner.poll_write(cx, buf))?;
this.sinks.outbound.fetch_add(
u64::try_from(num_bytes).unwrap_or(u64::max_value()),
u64::try_from(num_bytes).unwrap_or(u64::MAX),
Ordering::Relaxed,
);
Poll::Ready(Ok(num_bytes))
Expand All @@ -198,7 +198,7 @@ impl<SMInner: AsyncWrite> AsyncWrite for InstrumentedStream<SMInner> {
let this = self.project();
let num_bytes = ready!(this.inner.poll_write_vectored(cx, bufs))?;
this.sinks.outbound.fetch_add(
u64::try_from(num_bytes).unwrap_or(u64::max_value()),
u64::try_from(num_bytes).unwrap_or(u64::MAX),
Ordering::Relaxed,
);
Poll::Ready(Ok(num_bytes))
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions misc/metrics/src/bandwidth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ impl<SMInner: AsyncRead> AsyncRead for InstrumentedStream<SMInner> {
let num_bytes = ready!(this.inner.poll_read(cx, buf))?;
this.metrics
.inbound
.inc_by(u64::try_from(num_bytes).unwrap_or(u64::max_value()));
.inc_by(u64::try_from(num_bytes).unwrap_or(u64::MAX));
Poll::Ready(Ok(num_bytes))
}

Expand All @@ -268,7 +268,7 @@ impl<SMInner: AsyncRead> AsyncRead for InstrumentedStream<SMInner> {
let num_bytes = ready!(this.inner.poll_read_vectored(cx, bufs))?;
this.metrics
.inbound
.inc_by(u64::try_from(num_bytes).unwrap_or(u64::max_value()));
.inc_by(u64::try_from(num_bytes).unwrap_or(u64::MAX));
Poll::Ready(Ok(num_bytes))
}
}
Expand All @@ -283,7 +283,7 @@ impl<SMInner: AsyncWrite> AsyncWrite for InstrumentedStream<SMInner> {
let num_bytes = ready!(this.inner.poll_write(cx, buf))?;
this.metrics
.outbound
.inc_by(u64::try_from(num_bytes).unwrap_or(u64::max_value()));
.inc_by(u64::try_from(num_bytes).unwrap_or(u64::MAX));
Poll::Ready(Ok(num_bytes))
}

Expand All @@ -296,7 +296,7 @@ impl<SMInner: AsyncWrite> AsyncWrite for InstrumentedStream<SMInner> {
let num_bytes = ready!(this.inner.poll_write_vectored(cx, bufs))?;
this.metrics
.outbound
.inc_by(u64::try_from(num_bytes).unwrap_or(u64::max_value()));
.inc_by(u64::try_from(num_bytes).unwrap_or(u64::MAX));
Poll::Ready(Ok(num_bytes))
}

Expand Down
1 change: 0 additions & 1 deletion misc/multistream-select/src/length_delimited.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use std::{
io,
pin::Pin,
task::{Context, Poll},
u16,
};

const MAX_LEN_BYTES: u16 = 2;
Expand Down
2 changes: 1 addition & 1 deletion misc/quickcheck-ext/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub trait GenRange {
fn gen_range<T: Unsigned + Arbitrary + Copy>(&mut self, _range: Range<T>) -> T;

fn gen_index(&mut self, ubound: usize) -> usize {
if ubound <= (core::u32::MAX as usize) {
if ubound <= (u32::MAX as usize) {
self.gen_range(0..ubound as u32) as usize
} else {
self.gen_range(0..ubound)
Expand Down
2 changes: 1 addition & 1 deletion protocols/kad/src/kbucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ mod tests {
assert!(!bucket_ref.contains(&Distance(min.0 - 1)));
}

if max != Distance(U256::max_value()) {
if max != Distance(U256::MAX) {
// ^ avoid overflow
assert!(!bucket_ref.contains(&Distance(max.0 + 1)));
}
Expand Down
2 changes: 1 addition & 1 deletion protocols/mdns/src/behaviour/iface/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ fn duration_to_secs(duration: Duration) -> u32 {
let secs = duration
.as_secs()
.saturating_add(u64::from(duration.subsec_nanos() > 0));
cmp::min(secs, From::from(u32::max_value())) as u32
cmp::min(secs, From::from(u32::MAX)) as u32
}

/// Appends a big-endian u32 to `out`.
Expand Down
4 changes: 2 additions & 2 deletions protocols/mdns/src/behaviour/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub(crate) mod tokio {
// Taken from: https://docs.rs/async-io/1.7.0/src/async_io/lib.rs.html#91
let mut inner = time::interval_at(
TokioInstant::from_std(instant),
Duration::new(std::u64::MAX, 1_000_000_000 - 1),
Duration::new(u64::MAX, 1_000_000_000 - 1),
);
inner.set_missed_tick_behavior(MissedTickBehavior::Skip);
Self { inner }
Expand All @@ -125,7 +125,7 @@ pub(crate) mod tokio {
}

fn size_hint(&self) -> (usize, Option<usize>) {
(std::usize::MAX, None)
(usize::MAX, None)
}
}
}
3 changes: 3 additions & 0 deletions transports/websocket-websys/src/web_context.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// TODO: remove when https://github.com/rust-lang/rust-clippy/issues/12377 fix lands in stable clippy.
#![allow(clippy::empty_docs)]

use wasm_bindgen::prelude::*;
use web_sys::window;

Expand Down

0 comments on commit 3926bc9

Please sign in to comment.