Skip to content

Commit 0d01a42

Browse files
authored
chore: address clippy lints for Rust 1.86.0-beta
Pull-Request: #5876.
1 parent c34a77b commit 0d01a42

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

misc/quick-protobuf-codec/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ mod tests {
252252

253253
let mut src = BytesMut::new();
254254
src.extend_from_slice(encoded_length);
255-
src.extend(std::iter::repeat(0).take(length));
255+
src.extend(std::iter::repeat_n(0, length));
256256
src
257257
}
258258

protocols/autonat/src/v2/client/handler/dial_request.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::{
22
collections::VecDeque,
33
convert::Infallible,
44
io,
5-
iter::{once, repeat},
5+
iter::{once, repeat_n},
66
task::{Context, Poll},
77
time::Duration,
88
};
@@ -326,8 +326,7 @@ where
326326
{
327327
let count_full = num_bytes / DATA_FIELD_LEN_UPPER_BOUND;
328328
let partial_len = num_bytes % DATA_FIELD_LEN_UPPER_BOUND;
329-
for req in repeat(DATA_FIELD_LEN_UPPER_BOUND)
330-
.take(count_full)
329+
for req in repeat_n(DATA_FIELD_LEN_UPPER_BOUND, count_full)
331330
.chain(once(partial_len))
332331
.filter(|e| *e > 0)
333332
.map(|data_count| {

protocols/kad/src/kbucket/key.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1818
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
1919
// DEALINGS IN THE SOFTWARE.
20+
#![allow(clippy::manual_div_ceil)]
2021

2122
use std::{
2223
borrow::Borrow,

protocols/kad/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub use record::{store, Key as RecordKey, ProviderRecord, Record};
8888
/// DHT should agree on the choices made for (1) and (2).
8989
///
9090
/// The current value is `20`.
91-
pub const K_VALUE: NonZeroUsize = unsafe { NonZeroUsize::new_unchecked(20) };
91+
pub const K_VALUE: NonZeroUsize = NonZeroUsize::new(20).unwrap();
9292

9393
/// The `α` parameter of the Kademlia specification.
9494
///
@@ -98,7 +98,7 @@ pub const K_VALUE: NonZeroUsize = unsafe { NonZeroUsize::new_unchecked(20) };
9898
/// locating the closest peers to a key.
9999
///
100100
/// The current value is `3`.
101-
pub const ALPHA_VALUE: NonZeroUsize = unsafe { NonZeroUsize::new_unchecked(3) };
101+
pub const ALPHA_VALUE: NonZeroUsize = NonZeroUsize::new(3).unwrap();
102102

103103
pub const PROTOCOL_NAME: StreamProtocol = protocol::DEFAULT_PROTO_NAME;
104104

transports/webrtc/src/tokio/udp_mux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ fn ufrag_from_stun_message(buffer: &[u8], local_ufrag: bool) -> Result<String, E
561561
let res = if local_ufrag {
562562
s.split(':').next()
563563
} else {
564-
s.split(':').last()
564+
s.split(':').next_back()
565565
};
566566
match res {
567567
Some(s) => Ok(s.to_owned()),

0 commit comments

Comments
 (0)