Skip to content

Commit 0cdc656

Browse files
committed
Style nits
1 parent 43ccedd commit 0cdc656

File tree

11 files changed

+33
-37
lines changed

11 files changed

+33
-37
lines changed

boring-sys/build/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ impl Config {
5454
let features = Features::from_env();
5555
let env = Env::from_env(&host, &target, features.is_fips_like());
5656

57-
let mut is_bazel = false;
58-
if let Some(src_path) = &env.source_path {
59-
is_bazel = src_path.join("src").exists();
60-
}
57+
let is_bazel = env
58+
.source_path
59+
.as_ref()
60+
.is_some_and(|path| path.join("src").exists());
6161

6262
let config = Self {
6363
manifest_dir,

boring-sys/build/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ fn get_boringssl_source_path(config: &Config) -> &PathBuf {
152152
///
153153
/// MSVC generator on Windows place static libs in a target sub-folder,
154154
/// so adjust library location based on platform and build target.
155-
/// See issue: https://github.com/alexcrichton/cmake-rs/issues/18
155+
/// See issue: <https://github.com/alexcrichton/cmake-rs/issues/18>
156156
fn get_boringssl_platform_output_path(config: &Config) -> String {
157157
if config.target.ends_with("-msvc") {
158158
// Code under this branch should match the logic in cmake-rs
@@ -193,7 +193,7 @@ fn get_boringssl_platform_output_path(config: &Config) -> String {
193193
}
194194
}
195195

196-
/// Returns a new cmake::Config for building BoringSSL.
196+
/// Returns a new `cmake::Config` for building BoringSSL.
197197
///
198198
/// It will add platform-specific parameters if needed.
199199
fn get_boringssl_cmake_config(config: &Config) -> cmake::Config {
@@ -340,7 +340,7 @@ fn get_boringssl_cmake_config(config: &Config) -> cmake::Config {
340340
boringssl_cmake
341341
}
342342

343-
/// Verify that the toolchains match https://csrc.nist.gov/CSRC/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp3678.pdf
343+
/// Verify that the toolchains match <https://csrc.nist.gov/CSRC/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp3678.pdf>
344344
/// See "Installation Instructions" under section 12.1.
345345
// TODO: maybe this should also verify the Go and Ninja versions? But those haven't been an issue in practice ...
346346
fn verify_fips_clang_version() -> (&'static str, &'static str) {

boring/examples/mk_certs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ fn real_main() -> Result<(), ErrorStack> {
147147
match ca_cert.issued(&cert) {
148148
Ok(()) => println!("Certificate verified!"),
149149
Err(ver_err) => println!("Failed to verify certificate: {ver_err}"),
150-
};
150+
}
151151

152152
Ok(())
153153
}
@@ -156,5 +156,5 @@ fn main() {
156156
match real_main() {
157157
Ok(()) => println!("Finished."),
158158
Err(e) => println!("Error: {e}"),
159-
};
159+
}
160160
}

boring/src/dh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ where
3232
}
3333

3434
to_der! {
35-
/// Serializes the parameters into a DER-encoded PKCS#3 DHparameter structure.
35+
/// Serializes the parameters into a DER-encoded PKCS#3 `DHparameter` structure.
3636
#[corresponds(i2d_DHparams)]
3737
params_to_der,
3838
ffi::i2d_DHparams

boring/src/ssl/async_callbacks.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl SslContextBuilder {
9595
let finish = fut_result.or(Err(SelectCertError::ERROR))?;
9696

9797
finish(client_hello).or(Err(SelectCertError::ERROR))
98-
})
98+
});
9999
}
100100

101101
/// Configures a custom private key method on the context.
@@ -144,7 +144,7 @@ impl SslContextBuilder {
144144
}
145145
};
146146

147-
self.set_get_session_callback(async_callback)
147+
self.set_get_session_callback(async_callback);
148148
}
149149

150150
/// Configures certificate verification.
@@ -167,7 +167,7 @@ impl SslContextBuilder {
167167
where
168168
F: Fn(&mut SslRef) -> Result<BoxCustomVerifyFuture, SslAlert> + Send + Sync + 'static,
169169
{
170-
self.set_custom_verify_callback(mode, async_custom_verify_callback(callback))
170+
self.set_custom_verify_callback(mode, async_custom_verify_callback(callback));
171171
}
172172
}
173173

@@ -176,7 +176,7 @@ impl SslRef {
176176
where
177177
F: Fn(&mut SslRef) -> Result<BoxCustomVerifyFuture, SslAlert> + Send + Sync + 'static,
178178
{
179-
self.set_custom_verify_callback(mode, async_custom_verify_callback(callback))
179+
self.set_custom_verify_callback(mode, async_custom_verify_callback(callback));
180180
}
181181

182182
/// Sets the task waker to be used in async callbacks installed on this `Ssl`.

boring/src/ssl/callbacks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ pub(super) unsafe extern "C" fn raw_remove_session<F>(
399399
.ex_data(SslContext::cached_ex_index::<F>())
400400
.expect("BUG: remove session callback missing");
401401

402-
callback(ctx, session)
402+
callback(ctx, session);
403403
}
404404

405405
type DataPtr = *const c_uchar;

boring/src/ssl/mod.rs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,7 +1841,7 @@ impl SslContextBuilder {
18411841
+ Sync
18421842
+ Send,
18431843
{
1844-
self.set_psk_client_callback(callback)
1844+
self.set_psk_client_callback(callback);
18451845
}
18461846

18471847
/// Sets the callback for providing an identity and pre-shared key for a TLS-PSK server.
@@ -3217,7 +3217,7 @@ impl SslRef {
32173217

32183218
/// Returns a short string describing the state of the session.
32193219
///
3220-
/// Returns empty string if the state wasn't valid UTF-8
3220+
/// Returns empty string if the state wasn't valid UTF-8.
32213221
#[corresponds(SSL_state_string)]
32223222
#[must_use]
32233223
pub fn state_string(&self) -> &'static str {
@@ -3231,7 +3231,7 @@ impl SslRef {
32313231

32323232
/// Returns a longer string describing the state of the session.
32333233
///
3234-
/// Returns empty string if the state wasn't valid UTF-8
3234+
/// Returns empty string if the state wasn't valid UTF-8.
32353235
#[corresponds(SSL_state_string_long)]
32363236
#[must_use]
32373237
pub fn state_string_long(&self) -> &'static str {
@@ -4034,10 +4034,11 @@ impl<S> MidHandshakeSslStream<S> {
40344034
Ok(self.stream)
40354035
} else {
40364036
self.error = self.stream.make_error(ret);
4037-
match self.error.would_block() {
4038-
true => Err(HandshakeError::WouldBlock(self)),
4039-
false => Err(HandshakeError::Failure(self)),
4040-
}
4037+
Err(if self.error.would_block() {
4038+
HandshakeError::WouldBlock(self)
4039+
} else {
4040+
HandshakeError::Failure(self)
4041+
})
40414042
}
40424043
}
40434044
}
@@ -4461,16 +4462,11 @@ where
44614462
Ok(stream)
44624463
} else {
44634464
let error = stream.make_error(ret);
4464-
match error.would_block() {
4465-
true => Err(HandshakeError::WouldBlock(MidHandshakeSslStream {
4466-
stream,
4467-
error,
4468-
})),
4469-
false => Err(HandshakeError::Failure(MidHandshakeSslStream {
4470-
stream,
4471-
error,
4472-
})),
4473-
}
4465+
Err(if error.would_block() {
4466+
HandshakeError::WouldBlock(MidHandshakeSslStream { stream, error })
4467+
} else {
4468+
HandshakeError::Failure(MidHandshakeSslStream { stream, error })
4469+
})
44744470
}
44754471
}
44764472
}

boring/src/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ foreign_type_and_impl_send_sync! {
1515

1616
/// # Safety
1717
///
18-
/// MUST be UTF-8
18+
/// MUST be UTF-8.
1919
pub struct OpensslString;
2020
}
2121

boring/src/x509/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ impl fmt::Debug for X509 {
864864

865865
if let Ok(public_key) = &self.public_key() {
866866
debug_struct.field("public_key", public_key);
867-
};
867+
}
868868
// TODO: Print extensions once they are supported on the X509 struct.
869869

870870
debug_struct.finish()
@@ -1535,7 +1535,7 @@ impl X509VerifyError {
15351535

15361536
/// Return a human readable error string from the verification error.
15371537
///
1538-
/// Returns empty string if the message was not UTF-8
1538+
/// Returns empty string if the message was not UTF-8.
15391539
#[corresponds(X509_verify_cert_error_string)]
15401540
#[allow(clippy::trivially_copy_pass_by_ref)]
15411541
#[must_use]

boring/src/x509/tests/trusted_first.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn test_verify_cert() {
6161
Ok(()),
6262
verify(&leaf, &[&root1], &[&intermediate, &root1_cross], |param| {
6363
param.clear_flags(X509Flags::TRUSTED_FIRST)
64-
},)
64+
})
6565
);
6666
}
6767

0 commit comments

Comments
 (0)