Skip to content

Commit

Permalink
chore: applied clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
leontoeides committed Oct 5, 2024
1 parent ae9ff66 commit 6b4853c
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 12 deletions.
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,11 @@
#![forbid(unsafe_code)]
#![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)]
#![allow(clippy::module_name_repetitions)]
#![allow(
clippy::empty_line_after_doc_comments,
clippy::module_name_repetitions,
clippy::too_long_first_doc_paragraph
)]
#![doc(html_favicon_url = "https://www.arkiteq.ca/crates/indicium/icon.png")]
#![doc(html_logo_url = "https://www.arkiteq.ca/crates/indicium/logo.png")]

Expand Down
2 changes: 1 addition & 1 deletion src/simple/internal/fuzzy_top_scores/find_bottom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::hash::Hash;

// -----------------------------------------------------------------------------

impl<'a, K: Hash + Ord, S: Clone + PartialOrd> FuzzyTopScores<'a, K, S> {
impl<K: Hash + Ord, S: Clone + PartialOrd> FuzzyTopScores<'_, K, S> {
// -------------------------------------------------------------------------
//
/// Finds and caches the lowest (or bottom) top score.
Expand Down
2 changes: 1 addition & 1 deletion src/simple/internal/fuzzy_top_scores/remove_bottom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::hash::Hash;

// -----------------------------------------------------------------------------

impl<'a, K: Hash + Ord, S: PartialOrd> FuzzyTopScores<'a, K, S> {
impl<K: Hash + Ord, S: PartialOrd> FuzzyTopScores<'_, K, S> {
// -------------------------------------------------------------------------
//
/// Removes the lowest top score from the list. This is normally done before
Expand Down
2 changes: 1 addition & 1 deletion src/simple/internal/fuzzy_top_scores/with_capacity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::hash::Hash;

// -----------------------------------------------------------------------------

impl<'a, K: Hash + Ord, S: PartialOrd> FuzzyTopScores<'a, K, S> {
impl<K: Hash + Ord, S: PartialOrd> FuzzyTopScores<'_, K, S> {
// -------------------------------------------------------------------------
#![allow(clippy::default_trait_access)]
/// Instantiates a new "top scores" struct with the caller provided
Expand Down
2 changes: 1 addition & 1 deletion src/simple/internal/search_top_scores/find_bottom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::hash::Hash;

// -----------------------------------------------------------------------------

impl<'a, K: Hash + Ord> SearchTopScores<'a, K> {
impl<K: Hash + Ord> SearchTopScores<'_, K> {
// -------------------------------------------------------------------------
//
/// Finds and caches the lowest (or bottom) top score.
Expand Down
2 changes: 1 addition & 1 deletion src/simple/internal/search_top_scores/remove_bottom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::hash::Hash;

// -----------------------------------------------------------------------------

impl<'a, K: Hash + Ord> SearchTopScores<'a, K> {
impl<K: Hash + Ord> SearchTopScores<'_, K> {
// -------------------------------------------------------------------------
//
/// Removes the lowest top score from the list. This is normally done before
Expand Down
2 changes: 1 addition & 1 deletion src/simple/internal/search_top_scores/with_capacity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::hash::Hash;

// -----------------------------------------------------------------------------

impl<'a, K: Hash + Ord> SearchTopScores<'a, K> {
impl<K: Hash + Ord> SearchTopScores<'_, K> {
// -------------------------------------------------------------------------
#![allow(clippy::default_trait_access)]
/// Instantiates a new "top scores" struct with the caller provided
Expand Down
10 changes: 5 additions & 5 deletions src/simple/internal/string_keywords.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub enum SplitContext {
/// keywords. If it is, function will return `true`. If there are no excluded
/// keywords, function will always return `false`.
pub fn exclude_keyword(keyword: &str, exclude_keywords: &Option<Vec<KString>>) -> bool {
pub fn exclude_keyword(keyword: &str, exclude_keywords: Option<&Vec<KString>>) -> bool {
// Check to see if there's any keywords in the exclusion list:
exclude_keywords.as_ref().map_or(false, |exclude_keywords| {
exclude_keywords
Expand All @@ -46,9 +46,9 @@ fn test_exclude_keyword() {
"fall’n".into(),
]); // vec!

assert!(exclude_keyword("arise", &excluded_keywords));
assert!(exclude_keyword("arise", excluded_keywords.as_ref()));

assert!(!exclude_keyword("arose", &excluded_keywords));
assert!(!exclude_keyword("arose", excluded_keywords.as_ref()));
}

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -89,7 +89,7 @@ impl<K: Ord> SearchIndex<K> {
&& chars <= self.maximum_keyword_length
}) // filter
// Only keep the keyword if it's not in the exclusion list:
.filter(|keyword| !exclude_keyword(keyword, &self.exclude_keywords)) // filter
.filter(|keyword| !exclude_keyword(keyword, self.exclude_keywords.as_ref())) // filter
// Copy string from reference:
.map(KString::from_ref)
// Collect all keywords into a `Vec`:
Expand Down Expand Up @@ -124,7 +124,7 @@ impl<K: Ord> SearchIndex<K> {
if context == &SplitContext::Indexing
&& chars >= self.minimum_keyword_length
&& chars <= maximum_string_length
&& !exclude_keyword(&string, &self.exclude_keywords)
&& !exclude_keyword(&string, self.exclude_keywords.as_ref())
{
// Add field text / entire string to the keyword `Vec`:
keywords.push(string);
Expand Down

0 comments on commit 6b4853c

Please sign in to comment.