Skip to content

Commit

Permalink
selabel: Fix clippy lint (#61)
Browse files Browse the repository at this point in the history
```
warning: manual case-insensitive ASCII comparison
   --> src/selabel.rs:248:16
    |
248 |             if key.trim().to_ascii_uppercase() == "SELINUXTYPE" {
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_ignore_case_cmp
    = note: `#[warn(clippy::manual_ignore_case_cmp)]` on by default
help: consider using `.eq_ignore_ascii_case()` instead
    |
248 |             if key.trim().eq_ignore_ascii_case("SELINUXTYPE") {
    |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Signed-off-by: Timothée Ravier <[email protected]>
  • Loading branch information
travier authored Jan 17, 2025
1 parent 94d4ce8 commit 78f37ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/selabel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ fn parse_config(file: impl Read) -> Result<Option<String>> {
for line in BufReader::new(file).lines() {
if let Some((key, value)) = line?.split_once('=') {
// this might be a comment, but then key will start with '#'
if key.trim().to_ascii_uppercase() == "SELINUXTYPE" {
if key.trim().eq_ignore_ascii_case("SELINUXTYPE") {
return Ok(Some(value.trim().to_string()));
}
}
Expand Down

0 comments on commit 78f37ea

Please sign in to comment.