Skip to content

Commit b1e16e9

Browse files
committed
clippy: use strip_prefix instead of manually strip
1 parent fb5ae60 commit b1e16e9

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

openssl-sys/build/main.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,14 @@ See rust-openssl documentation for more information:
203203
let libressl_prefix = "RUST_VERSION_LIBRESSL_";
204204
let boringsl_prefix = "RUST_OPENSSL_IS_BORINGSSL";
205205
let conf_prefix = "RUST_CONF_";
206-
if line.starts_with(openssl_prefix) {
207-
let version = &line[openssl_prefix.len()..];
206+
if let Some(version) = line.strip_prefix(openssl_prefix) {
208207
openssl_version = Some(parse_version(version));
209-
} else if line.starts_with(new_openssl_prefix) {
210-
let version = &line[new_openssl_prefix.len()..];
208+
} else if let Some(version) = line.strip_prefix(new_openssl_prefix) {
211209
openssl_version = Some(parse_new_version(version));
212-
} else if line.starts_with(libressl_prefix) {
213-
let version = &line[libressl_prefix.len()..];
210+
} else if let Some(version) = line.strip_prefix(libressl_prefix) {
214211
libressl_version = Some(parse_version(version));
215-
} else if line.starts_with(conf_prefix) {
216-
enabled.push(&line[conf_prefix.len()..]);
212+
} else if let Some(conf) = line.strip_prefix(conf_prefix) {
213+
enabled.push(conf);
217214
} else if line.starts_with(boringsl_prefix) {
218215
is_boringssl = true;
219216
}

0 commit comments

Comments
 (0)