summaryrefslogtreecommitdiff
path: root/cli/tools
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tools')
-rw-r--r--cli/tools/bench.rs2
-rw-r--r--cli/tools/coverage/merge.rs3
-rw-r--r--cli/tools/coverage/range_tree.rs9
-rw-r--r--cli/tools/fmt.rs2
-rw-r--r--cli/tools/standalone.rs4
-rw-r--r--cli/tools/test.rs4
-rw-r--r--cli/tools/vendor/build.rs2
-rw-r--r--cli/tools/vendor/mod.rs4
8 files changed, 12 insertions, 18 deletions
diff --git a/cli/tools/bench.rs b/cli/tools/bench.rs
index 1868d76b3..c055d8a9c 100644
--- a/cli/tools/bench.rs
+++ b/cli/tools/bench.rs
@@ -210,7 +210,7 @@ impl BenchReporter for ConsoleReporter {
println!();
}
- if None == self.group || group != self.group.as_ref().unwrap() {
+ if self.group.is_none() || group != self.group.as_ref().unwrap() {
self.report_group_summary();
}
diff --git a/cli/tools/coverage/merge.rs b/cli/tools/coverage/merge.rs
index 08a695e1d..63b795f76 100644
--- a/cli/tools/coverage/merge.rs
+++ b/cli/tools/coverage/merge.rs
@@ -126,8 +126,7 @@ pub fn merge_functions(
trees.push(tree);
}
}
- let merged =
- RangeTree::normalize(&rta, merge_range_trees(&rta, trees).unwrap());
+ let merged = RangeTree::normalize(merge_range_trees(&rta, trees).unwrap());
let ranges = merged.to_ranges();
let is_block_coverage: bool = !(ranges.len() == 1 && ranges[0].count == 0);
diff --git a/cli/tools/coverage/range_tree.rs b/cli/tools/coverage/range_tree.rs
index aca8939ee..87ddd8baa 100644
--- a/cli/tools/coverage/range_tree.rs
+++ b/cli/tools/coverage/range_tree.rs
@@ -71,10 +71,7 @@ impl<'rt> RangeTree<'rt> {
(rta.alloc(left), rta.alloc(right))
}
- pub fn normalize<'a>(
- rta: &'a RangeTreeArena<'a>,
- tree: &'a mut RangeTree<'a>,
- ) -> &'a mut RangeTree<'a> {
+ pub fn normalize<'a>(tree: &'a mut RangeTree<'a>) -> &'a mut RangeTree<'a> {
tree.children = {
let mut children: Vec<&'a mut RangeTree<'a>> = Vec::new();
let mut chain: Vec<&'a mut RangeTree<'a>> = Vec::new();
@@ -96,7 +93,7 @@ impl<'rt> RangeTree<'rt> {
head.children.push(sub_child);
}
}
- children.push(RangeTree::normalize(rta, head));
+ children.push(RangeTree::normalize(head));
}
chain.push(child)
}
@@ -110,7 +107,7 @@ impl<'rt> RangeTree<'rt> {
head.children.push(sub_child);
}
}
- children.push(RangeTree::normalize(rta, head));
+ children.push(RangeTree::normalize(head));
}
if children.len() == 1
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs
index 832577aa2..9474411b7 100644
--- a/cli/tools/fmt.rs
+++ b/cli/tools/fmt.rs
@@ -635,7 +635,7 @@ struct FileContents {
}
fn read_file_contents(file_path: &Path) -> Result<FileContents, AnyError> {
- let file_bytes = fs::read(&file_path)
+ let file_bytes = fs::read(file_path)
.with_context(|| format!("Error reading {}", file_path.display()))?;
let charset = text_encoding::detect_charset(&file_bytes);
let file_text = text_encoding::convert_to_utf8(&file_bytes, charset)?;
diff --git a/cli/tools/standalone.rs b/cli/tools/standalone.rs
index 259eb43b0..494c2f476 100644
--- a/cli/tools/standalone.rs
+++ b/cli/tools/standalone.rs
@@ -85,9 +85,9 @@ async fn download_base_binary(
std::process::exit(1)
};
- std::fs::create_dir_all(&output_directory)?;
+ std::fs::create_dir_all(output_directory)?;
let output_path = output_directory.join(binary_path_suffix);
- std::fs::create_dir_all(&output_path.parent().unwrap())?;
+ std::fs::create_dir_all(output_path.parent().unwrap())?;
tokio::fs::write(output_path, binary_content).await?;
Ok(())
}
diff --git a/cli/tools/test.rs b/cli/tools/test.rs
index dca140445..09257efff 100644
--- a/cli/tools/test.rs
+++ b/cli/tools/test.rs
@@ -742,9 +742,7 @@ fn extract_files_from_regex_blocks(
let files = blocks_regex
.captures_iter(source)
.filter_map(|block| {
- if block.get(1) == None {
- return None;
- }
+ block.get(1)?;
let maybe_attributes: Option<Vec<_>> = block
.get(1)
diff --git a/cli/tools/vendor/build.rs b/cli/tools/vendor/build.rs
index f0a490a75..dadd84e22 100644
--- a/cli/tools/vendor/build.rs
+++ b/cli/tools/vendor/build.rs
@@ -502,7 +502,7 @@ mod test {
let output = builder
.with_loader(|loader| {
loader
- .add("/mod.ts", &mod_file_text)
+ .add("/mod.ts", mod_file_text)
.add("https://localhost/mod.ts", "export class Example {}");
})
.build()
diff --git a/cli/tools/vendor/mod.rs b/cli/tools/vendor/mod.rs
index 05fee531a..3fd381b21 100644
--- a/cli/tools/vendor/mod.rs
+++ b/cli/tools/vendor/mod.rs
@@ -113,7 +113,7 @@ fn validate_options(
.and_then(|p| fs_util::canonicalize_path(&p).ok())
{
// make the output directory in order to canonicalize it for the check below
- std::fs::create_dir_all(&output_dir)?;
+ std::fs::create_dir_all(output_dir)?;
let output_dir =
fs_util::canonicalize_path(output_dir).with_context(|| {
format!("Failed to canonicalize: {}", output_dir.display())
@@ -248,7 +248,7 @@ fn update_config_text(
}
fn is_dir_empty(dir_path: &Path) -> Result<bool, AnyError> {
- match std::fs::read_dir(&dir_path) {
+ match std::fs::read_dir(dir_path) {
Ok(mut dir) => Ok(dir.next().is_none()),
Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok(true),
Err(err) => {