Skip to content

Commit

Permalink
Fix new clippy lints
Browse files Browse the repository at this point in the history
* Needless borrow
* Explicit auto-deref
  • Loading branch information
maurer committed Sep 23, 2022
1 parent c26bdb3 commit f5cb751
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions openssl/src/ssl/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl SslConnector {

/// Returns a shared reference to the inner raw `SslContext`.
pub fn context(&self) -> &SslContextRef {
&*self.0
&self.0
}
}

Expand Down Expand Up @@ -334,7 +334,7 @@ impl SslAcceptor {

/// Returns a shared reference to the inner raw `SslContext`.
pub fn context(&self) -> &SslContextRef {
&*self.0
&self.0
}
}

Expand Down
20 changes: 10 additions & 10 deletions openssl/src/ssl/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ fn verify_callback() {
CALLED_BACK.store(true, Ordering::SeqCst);
let cert = x509.current_cert().unwrap();
let digest = cert.digest(MessageDigest::sha1()).unwrap();
assert_eq!(hex::encode(&digest), expected);
assert_eq!(hex::encode(digest), expected);
true
});

Expand All @@ -226,7 +226,7 @@ fn ssl_verify_callback() {
CALLED_BACK.store(true, Ordering::SeqCst);
let cert = x509.current_cert().unwrap();
let digest = cert.digest(MessageDigest::sha1()).unwrap();
assert_eq!(hex::encode(&digest), expected);
assert_eq!(hex::encode(digest), expected);
true
});

Expand Down Expand Up @@ -319,9 +319,9 @@ fn test_connect_with_srtp_ctx() {
let mut ctx = SslContext::builder(SslMethod::dtls()).unwrap();
ctx.set_tlsext_use_srtp("SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32")
.unwrap();
ctx.set_certificate_file(&Path::new("test/cert.pem"), SslFiletype::PEM)
ctx.set_certificate_file(Path::new("test/cert.pem"), SslFiletype::PEM)
.unwrap();
ctx.set_private_key_file(&Path::new("test/key.pem"), SslFiletype::PEM)
ctx.set_private_key_file(Path::new("test/key.pem"), SslFiletype::PEM)
.unwrap();
let mut ssl = Ssl::new(&ctx.build()).unwrap();
ssl.set_mtu(1500).unwrap();
Expand Down Expand Up @@ -375,9 +375,9 @@ fn test_connect_with_srtp_ssl() {
let guard = thread::spawn(move || {
let stream = listener.accept().unwrap().0;
let mut ctx = SslContext::builder(SslMethod::dtls()).unwrap();
ctx.set_certificate_file(&Path::new("test/cert.pem"), SslFiletype::PEM)
ctx.set_certificate_file(Path::new("test/cert.pem"), SslFiletype::PEM)
.unwrap();
ctx.set_private_key_file(&Path::new("test/key.pem"), SslFiletype::PEM)
ctx.set_private_key_file(Path::new("test/key.pem"), SslFiletype::PEM)
.unwrap();
let mut ssl = Ssl::new(&ctx.build()).unwrap();
ssl.set_tlsext_use_srtp("SRTP_AES128_CM_SHA1_80:SRTP_AES128_CM_SHA1_32")
Expand Down Expand Up @@ -1073,9 +1073,9 @@ fn keying_export() {
let guard = thread::spawn(move || {
let stream = listener.accept().unwrap().0;
let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
ctx.set_certificate_file(&Path::new("test/cert.pem"), SslFiletype::PEM)
ctx.set_certificate_file(Path::new("test/cert.pem"), SslFiletype::PEM)
.unwrap();
ctx.set_private_key_file(&Path::new("test/key.pem"), SslFiletype::PEM)
ctx.set_private_key_file(Path::new("test/key.pem"), SslFiletype::PEM)
.unwrap();
let ssl = Ssl::new(&ctx.build()).unwrap();
let mut stream = ssl.accept(stream).unwrap();
Expand Down Expand Up @@ -1271,10 +1271,10 @@ fn stateless() {

let mut server_ctx = SslContext::builder(SslMethod::tls()).unwrap();
server_ctx
.set_certificate_file(&Path::new("test/cert.pem"), SslFiletype::PEM)
.set_certificate_file(Path::new("test/cert.pem"), SslFiletype::PEM)
.unwrap();
server_ctx
.set_private_key_file(&Path::new("test/key.pem"), SslFiletype::PEM)
.set_private_key_file(Path::new("test/key.pem"), SslFiletype::PEM)
.unwrap();
const COOKIE: &[u8] = b"chocolate chip";
server_ctx.set_stateless_cookie_generate_cb(|_tls, buf| {
Expand Down
2 changes: 1 addition & 1 deletion openssl/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Stackable for OpensslString {

impl AsRef<str> for OpensslString {
fn as_ref(&self) -> &str {
&**self
self
}
}

Expand Down

0 comments on commit f5cb751

Please sign in to comment.