Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit97d05df

Browse files
committed
fix clippy 1.82.0 lints
1 parent8d6f114 commit97d05df

File tree

6 files changed

+11
-29
lines changed

6 files changed

+11
-29
lines changed

‎src/crypto/rustcrypto.rs‎

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,8 @@ pub type Result<T> = std::result::Result<T, CryptoError>;
1111
fncose_key_to_public(peer:&super::COSEEC2Key) ->Result<p256::PublicKey>{
1212
// SEC 1 encoded uncompressed point
1313
let peer = p256::EncodedPoint::from_affine_coordinates(
14-
peer.x
15-
.as_slice()
16-
.try_into()
17-
.map_err(|_|CryptoError::MalformedInput)?,
18-
peer.y
19-
.as_slice()
20-
.try_into()
21-
.map_err(|_|CryptoError::MalformedInput)?,
14+
peer.x.as_slice().into(),
15+
peer.y.as_slice().into(),
2216
false,
2317
);
2418
p256::PublicKey::from_encoded_point(&peer)
@@ -51,11 +45,7 @@ pub fn encrypt_aes_256_cbc_no_pad(key: &[u8], iv: Option<&[u8]>, data: &[u8]) ->
5145
Err(_) =>returnErr(CryptoError::LibraryFailure),
5246
};
5347

54-
let iv = iv.unwrap_or(&[0u8;AES_BLOCK_SIZE]);
55-
let iv =match iv.try_into(){
56-
Ok(iv) => iv,
57-
Err(_) =>returnErr(CryptoError::LibraryFailure),
58-
};
48+
let iv = iv.unwrap_or(&[0u8;AES_BLOCK_SIZE]).into();
5949

6050
// Validate that the data is an exact multiple of the block size since we have no
6151
// padding available.
@@ -90,11 +80,7 @@ pub fn decrypt_aes_256_cbc_no_pad(key: &[u8], iv: Option<&[u8]>, data: &[u8]) ->
9080
Err(_) =>returnErr(CryptoError::LibraryFailure),
9181
};
9282

93-
let iv = iv.unwrap_or(&[0u8;AES_BLOCK_SIZE]);
94-
let iv =match iv.try_into(){
95-
Ok(iv) => iv,
96-
Err(_) =>returnErr(CryptoError::LibraryFailure),
97-
};
83+
let iv = iv.unwrap_or(&[0u8;AES_BLOCK_SIZE]).into();
9884

9985
// See comments in `encrypt_aes_256_cbc_no_pad` for rationale.
10086
let blocks = data.chunks_exact(AES_BLOCK_SIZE);

‎src/ctap2/commands/get_assertion.rs‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@ impl GetAssertionOptions {
6262

6363
implUserVerificationforGetAssertionOptions{
6464
fnask_user_verification(&self) ->bool{
65-
ifletSome(e) =self.user_verification{
66-
e
67-
}else{
68-
false
69-
}
65+
self.user_verification.unwrap_or(false)
7066
}
7167
}
7268

‎src/ctap2/commands/make_credentials.rs‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,7 @@ pub(crate) trait UserVerification {
261261

262262
implUserVerificationforMakeCredentialsOptions{
263263
fnask_user_verification(&self) ->bool{
264-
ifletSome(e) =self.user_verification{
265-
e
266-
}else{
267-
false
268-
}
264+
self.user_verification.unwrap_or(false)
269265
}
270266
}
271267

‎src/transport/hidproto.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ pub enum Data {
4747
Usage{data:u32},
4848
Input,
4949
Output,
50+
#[allow(dead_code)]// we only read this on linux
5051
ReportCount{data:u32},
5152
}
5253

‎src/transport/linux/monitor.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const UDEV_SUBSYSTEM: &str = "hidraw";
1717
constPOLLIN:c_short =0x0001;
1818
constPOLL_TIMEOUT:c_int =100;
1919

20-
fnpoll(fds:&mutVec<::libc::pollfd>) -> io::Result<()>{
20+
fnpoll(fds:&mut[::libc::pollfd]) -> io::Result<()>{
2121
let nfds = fds.len()asc_ulong;
2222

2323
let rv =unsafe{::libc::poll((fds[..]).as_mut_ptr(), nfds,POLL_TIMEOUT)};

‎src/util.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,19 @@ macro_rules! try_or {
1818
};
1919
}
2020

21+
#[cfg(all(not(test), any(target_os ="linux", target_os ="freebsd", target_os ="openbsd")))]
2122
pubtraitSigned{
2223
fnis_negative(&self) ->bool;
2324
}
2425

26+
#[cfg(all(not(test), any(target_os ="linux", target_os ="freebsd", target_os ="openbsd")))]
2527
implSignedfori32{
2628
fnis_negative(&self) ->bool{
2729
*self <0
2830
}
2931
}
3032

33+
#[cfg(all(not(test), any(target_os ="linux", target_os ="freebsd", target_os ="openbsd")))]
3134
implSignedforusize{
3235
fnis_negative(&self) ->bool{
3336
(*selfasisize) <0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp