Skip to content

Commit 858c6f3

Browse files
committed
C++: Fix BMN Rust lints
The updated Rust toolchain introduced additional Clippy lints. This fixes the lints.
1 parent 187339d commit 858c6f3

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎cpp/extractor/bmn/src/compiler.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,13 +587,15 @@ mod tests {
587587
use super::*;
588588
use crate::test_utils::create_populate_tmp_dir;
589589
use all_asserts::assert_true;
590+
use std::slice;
590591

591592
#[test]
592593
fn test_indexing_compiler_default_folders() {
593594
let tmp_dir = create_populate_tmp_dir();
594595
let dirname = tmp_dir.path().to_path_buf();
595596

596-
let include_finder = CompilerDefaultIncludes::new(&[dirname.clone()], &[dirname]);
597+
let include_finder =
598+
CompilerDefaultIncludes::new(slice::from_ref(&dirname), slice::from_ref(&dirname));
597599
let default_c_include_dir_content = &include_finder.default_c_include_dir_content;
598600
let default_cpp_include_dir_content = &include_finder.default_cpp_include_dir_content;
599601

‎cpp/extractor/bmn/src/include_finder.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ mod tests {
638638

639639
mod find_includes {
640640
use crate::project_definitions::IncludeKind;
641+
use std::slice;
641642

642643
use super::*;
643644

@@ -836,7 +837,7 @@ mod tests {
836837
&project_files,
837838
&system_files,
838839
&compiler_defaults,
839-
&[include_directive.clone()],
840+
slice::from_ref(&include_directive),
840841
);
841842

842843
let empty: Vec<PathBuf> = vec![];

‎cpp/extractor/bmn/src/project_definitions.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl Hash for SourceFile {
116116

117117
impl PartialOrd<Self> for SourceFile {
118118
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
119-
Some(self.path.cmp(&other.path))
119+
Some(self.cmp(other))
120120
}
121121
}
122122

‎cpp/extractor/bmn/src/test_utils.rs‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use all_asserts::assert_true;
22
use std::fs::File;
33
use std::path::PathBuf;
44
use std::{env, fs};
5-
use tempfile::{tempdir, TempDir};
5+
use tempfile::{TempDir, tempdir};
66

77
/// This function tries to get the root test resource path.
88
/// If `allow_symlinks` is `false` will avoid the bazel off-tree test directory as this contains
@@ -124,9 +124,7 @@ mod tests {
124124
assert_true!(file_maybe_symlinked.exists());
125125
assert_true!(file_maybe_symlinked.ends_with("tests/resources/dir1/file1.c"));
126126

127-
let is_bazel = env::var("BAZEL_TEST")
128-
.map(|bazel| bazel == "1")
129-
.unwrap_or(false);
127+
let is_bazel = env::var("BAZEL_TEST").is_ok_and(|bazel| bazel == "1");
130128
if is_bazel {
131129
assert_true!(file_maybe_symlinked.is_symlink());
132130
} else {

0 commit comments

Comments
 (0)