Skip to content

Commit

Permalink
Gets rid of some clippy errors and warnings [fix]
Browse files Browse the repository at this point in the history
  • Loading branch information
hoijui committed Dec 5, 2023
1 parent 5c2a1c9 commit c66dc44
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub struct Coverage {

fn create_arbitrary_content_rgxs(tree_recs: &[RNode]) -> Vec<Regex> {
let mut rgxs = vec![];
for rec_node in tree_recs.iter() {
for rec_node in tree_recs {
let rec_brw = rec_node.borrow();
if let Some(rec) = rec_brw.value {
if let Some(arbitrary_content) = rec.arbitrary_content {
Expand All @@ -112,7 +112,7 @@ fn create_arbitrary_content_rgxs(tree_recs: &[RNode]) -> Vec<Regex> {

fn create_generated_content_rgxs(tree_recs: &[RNode]) -> Vec<Regex> {
let mut rgxs = vec![];
for rec_node in tree_recs.iter() {
for rec_node in tree_recs {
let rec_brw = rec_node.borrow();
if let Some(rec) = rec_brw.value {
if rec.generated {
Expand All @@ -138,7 +138,7 @@ fn create_generated_content_rgxs(tree_recs: &[RNode]) -> Vec<Regex> {
fn create_module_rgxs(tree_recs: &[RNode]) -> Vec<Regex> {
let mut rgxs = HashSet::new();
log::warn!("module rgxs:");
for rec_node in tree_recs.iter() {
for rec_node in tree_recs {
let rec_brw = rec_node.borrow();
if let Some(rec) = rec_brw.value {
if rec.module {
Expand Down Expand Up @@ -261,7 +261,7 @@ impl Checker {
self.coverage
.r#in
.entry(rec)
.or_insert_with(Vec::new)
.or_default()
.push(Rc::clone(dir_or_file));
}
}
Expand Down Expand Up @@ -464,6 +464,11 @@ where
///
/// If any of the input listing entires is an error,
/// usually caused by an I/O issue.
///
/// # Panics
///
/// Expecting `Option`s that logically have to be `Some`,
/// thus this should never panic in practice.
pub fn cover_listing_by_stds<T>(
dirs_and_files: T,
ignored_paths: &Regex,
Expand All @@ -474,9 +479,9 @@ where
{
Ok(match stds {
Standards::Default => {
let std = STDS
.get(DEFAULT_STD_NAME)
.expect("Clap already checked the name!");
let std = STDS.get(DEFAULT_STD_NAME).expect(
"This name was chosen from the data itsself, so it should alwyas be available",
);
vec![cover_listing_with(dirs_and_files, ignored_paths, std)?]
}
Standards::All => cover_listing(dirs_and_files, ignored_paths)?,
Expand Down
2 changes: 2 additions & 0 deletions src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later

#![allow(clippy::needless_raw_string_hashes)]

include!(concat!(env!("OUT_DIR"), "/data_gen.rs"));

0 comments on commit c66dc44

Please sign in to comment.