Skip to content

Commit

Permalink
clippy: use strip_prefix instead of manually strip
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Jun 19, 2023
1 parent fb5ae60 commit b1e16e9
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions openssl-sys/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,14 @@ See rust-openssl documentation for more information:
let libressl_prefix = "RUST_VERSION_LIBRESSL_";
let boringsl_prefix = "RUST_OPENSSL_IS_BORINGSSL";
let conf_prefix = "RUST_CONF_";
if line.starts_with(openssl_prefix) {
let version = &line[openssl_prefix.len()..];
if let Some(version) = line.strip_prefix(openssl_prefix) {
openssl_version = Some(parse_version(version));
} else if line.starts_with(new_openssl_prefix) {
let version = &line[new_openssl_prefix.len()..];
} else if let Some(version) = line.strip_prefix(new_openssl_prefix) {
openssl_version = Some(parse_new_version(version));
} else if line.starts_with(libressl_prefix) {
let version = &line[libressl_prefix.len()..];
} else if let Some(version) = line.strip_prefix(libressl_prefix) {
libressl_version = Some(parse_version(version));
} else if line.starts_with(conf_prefix) {
enabled.push(&line[conf_prefix.len()..]);
} else if let Some(conf) = line.strip_prefix(conf_prefix) {
enabled.push(conf);
} else if line.starts_with(boringsl_prefix) {
is_boringssl = true;
}
Expand Down

0 comments on commit b1e16e9

Please sign in to comment.