[function-grep] made filter mutable so now we can use tree sitter query #627
cargo_clippy_lib.yml
on: push
clippy_check
52s
test
54s
Annotations
1 error and 32 warnings
test
Process completed with exit code 101.
|
this `map_or` can be simplified:
git-function-history-lib/src/lib.rs#L551
warning: this `map_or` can be simplified
--> git-function-history-lib/src/lib.rs:551:5
|
551 | / filename
552 | | .extension()
553 | | .map_or(false, |ext| ext.eq_ignore_ascii_case(file_ext))
| |________________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
= note: `#[warn(clippy::unnecessary_map_or)]` on by default
help: use is_some_and instead
|
551 ~ filename
552 + .extension().is_some_and(|ext| ext.eq_ignore_ascii_case(file_ext))
|
|
this argument is passed by value, but not consumed in the function body:
git-function-history-lib/src/lib.rs#L537
warning: this argument is passed by value, but not consumed in the function body
--> git-function-history-lib/src/lib.rs:537:12
|
537 | files: Vec<(String, String)>,
| ^^^^^^^^^^^^^^^^^^^^^ help: consider changing the type to: `&[(String, String)]`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
|
this argument is passed by value, but not consumed in the function body:
git-function-history-lib/src/lib.rs#L337
warning: this argument is passed by value, but not consumed in the function body
--> git-function-history-lib/src/lib.rs:337:11
|
337 | path: String,
| ^^^^^^ help: consider changing the type to: `&str`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
|
this argument is passed by value, but not consumed in the function body:
git-function-history-lib/src/lib.rs#L322
warning: this argument is passed by value, but not consumed in the function body
--> git-function-history-lib/src/lib.rs:322:11
|
322 | repo: gix::Repository,
| ^^^^^^^^^^^^^^^ help: consider taking a reference instead: `&gix::Repository`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_value
= note: `#[warn(clippy::needless_pass_by_value)]` implied by `#[warn(clippy::pedantic)]`
|
docs for function which may panic missing `# Panics` section:
git-function-history-lib/src/lib.rs#L139
warning: docs for function which may panic missing `# Panics` section
--> git-function-history-lib/src/lib.rs:139:1
|
139 | / pub fn get_function_history(
140 | | name: &str,
141 | | file: &FileFilterType,
142 | | filter: &Filter,
143 | | langs: &[&dyn SupportedLanguage],
144 | | ) -> Result<FunctionHistory, Box<dyn Error + Send + Sync>> {
| |__________________________________________________________^
|
note: first possible panic found here
--> git-function-history-lib/src/lib.rs:234:17
|
234 | let langs = langs.instantiate_map(name).unwrap();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
|
docs for function which may panic missing `# Panics` section:
git-function-history-lib/src/types.rs#L84
warning: docs for function which may panic missing `# Panics` section
--> git-function-history-lib/src/types.rs:84:5
|
84 | pub fn get_metadata(&self) -> HashMap<String, String> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> git-function-history-lib/src/types.rs:90:201
|
90 | ...le|file.file_name().expect("error ocurred, could not get filename, no filename for current file\nfile a bug to https://github.com/mendelsshop/git_function_history/issues").to...
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
note: the lint level is defined here
--> git-function-history-lib/src/lib.rs:1:9
|
1 | #![warn(clippy::pedantic, clippy::nursery, clippy::cargo)]
| ^^^^^^^^^^^^^^^^
= note: `#[warn(clippy::missing_panics_doc)]` implied by `#[warn(clippy::pedantic)]`
|
empty line after doc comment:
git-function-history-lib/src/lib.rs#L14
warning: empty line after doc comment
--> git-function-history-lib/src/lib.rs:14:1
|
14 | / /// code and function related language
15 | |
| |_^
16 | /// Different types that can extracted from the result of `get_function_history`.
17 | pub mod types;
| ------------- the comment documents this module
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments
= note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default
= help: if the empty line is unintentional remove it
help: if the comment should document the crate use an inner doc comment
|
14 | //! code and function related language
| ~
help: if the documentation should include the empty line include it in the comment
|
15 | ///
|
|
trait `UnwrapToError` is never used:
git-function-history-lib/src/lib.rs#L556
warning: trait `UnwrapToError` is never used
--> git-function-history-lib/src/lib.rs:556:7
|
556 | trait UnwrapToError<T> {
| ^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
|
unused variable: `t`:
git-function-history-lib/src/types.rs#L329
warning: unused variable: `t`
--> git-function-history-lib/src/types.rs:329:13
|
329 | let t = self.commit_history.par_iter();
| ^ help: if this is intentional, prefix it with an underscore: `_t`
|
= note: `#[warn(unused_variables)]` on by default
|
unused import: `ParallelIterator`:
git-function-history-lib/src/types.rs#L4
warning: unused import: `ParallelIterator`
--> git-function-history-lib/src/types.rs:4:47
|
4 | use rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
|
unused macro definition: `get_item_from`:
git-function-history-lib/src/lib.rs#L18
warning: unused macro definition: `get_item_from`
--> git-function-history-lib/src/lib.rs:18:14
|
18 | macro_rules! get_item_from {
| ^^^^^^^^^^^^^
|
= note: `#[warn(unused_macros)]` on by default
|
first doc comment paragraph is too long:
function-grep/src/lib.rs#L80
warning: first doc comment paragraph is too long
--> function-grep/src/lib.rs:80:1
|
80 | / /// Tries to find the appropiate language for the given file [`file_name`] based on the list of
81 | | /// languages [`langs`] provided.
82 | | /// This works by obtaining the extension from the file path and using
83 | | /// [`get_file_type_from_file_ext`].
84 | | ///
85 | | /// # Errors
| |_^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_long_first_doc_paragraph
= note: `#[warn(clippy::too_long_first_doc_paragraph)]` implied by `#[warn(clippy::nursery)]`
|
docs for function returning `Result` missing `# Errors` section:
function-grep/src/supported_languages.rs#L229
warning: docs for function returning `Result` missing `# Errors` section
--> function-grep/src/supported_languages.rs:229:5
|
229 | / fn instantiate_map(
230 | | self,
231 | | name: &'a str,
232 | | ) -> Result<Vec<InstantiatedLanguage<'a>>, InstantiationError>;
| |___________________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
docs for function returning `Result` missing `# Errors` section:
function-grep/src/supported_languages.rs#L219
warning: docs for function returning `Result` missing `# Errors` section
--> function-grep/src/supported_languages.rs:219:5
|
219 | / fn to_language<'a>(
220 | | &self,
221 | | search: &'a str,
222 | | ) -> Result<InstantiatedLanguage<'a>, InstantiationError> {
| |_____________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
docs for function returning `Result` missing `# Errors` section:
function-grep/src/supported_languages.rs#L218
warning: docs for function returning `Result` missing `# Errors` section
--> function-grep/src/supported_languages.rs:218:5
|
218 | fn instantiate(&self, search: Box<str>) -> Result<QueryFunction, InstantiationError>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
called `map(<f>).unwrap_or_else(<g>)` on a `Result` value:
function-grep/src/supported_languages.rs#L184
warning: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value
--> function-grep/src/supported_languages.rs:184:21
|
184 | / tag_config
185 | | .generate_tags(&mut tag_context, code, None)
186 | | .map(|tags| {
187 | | let ranges = tags
... |
202 | | })
203 | | .unwrap_or_else(|_| vec![].into_boxed_slice())
| |______________________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or
= note: `#[warn(clippy::map_unwrap_or)]` implied by `#[warn(clippy::pedantic)]`
|
some fields in `TagsConfigurationThreadSafe` are not safe to be sent to another thread:
function-grep/src/supported_languages.rs#L153
warning: some fields in `TagsConfigurationThreadSafe` are not safe to be sent to another thread
--> function-grep/src/supported_languages.rs:153:1
|
153 | unsafe impl Send for TagsConfigurationThreadSafe {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: it is not safe to send field `0` to another thread
--> function-grep/src/supported_languages.rs:152:36
|
152 | struct TagsConfigurationThreadSafe(TagsConfiguration);
| ^^^^^^^^^^^^^^^^^
= help: use a thread-safe type that implements `Send`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#non_send_fields_in_send_ty
= note: `#[warn(clippy::non_send_fields_in_send_ty)]` implied by `#[warn(clippy::nursery)]`
|
docs for function returning `Result` missing `# Errors` section:
function-grep/src/filter.rs#L369
warning: docs for function returning `Result` missing `# Errors` section
--> function-grep/src/filter.rs:369:5
|
369 | pub fn add_filter(&mut self, filter: impl Into<FilterType<'a>>) -> Result<(), String> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
method `default` can be confused for the standard trait method `std::default::Default::default`:
function-grep/src/filter.rs#L316
warning: method `default` can be confused for the standard trait method `std::default::Default::default`
--> function-grep/src/filter.rs:316:5
|
316 | / pub fn default() -> Self {
317 | | Self {
318 | | filters: HashMap::from([
... |
365 | | }
| |_____^
|
= help: consider implementing the trait `std::default::Default` or choosing a less ambiguous method name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait
= note: `#[warn(clippy::should_implement_trait)]` on by default
|
docs for function returning `Result` missing `# Errors` section:
function-grep/src/filter.rs#L264
warning: docs for function returning `Result` missing `# Errors` section
--> function-grep/src/filter.rs:264:5
|
264 | pub fn to_filter(&self, s: &str) -> Result<InstantiatedFilterType, String> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
manual `Debug` impl does not include all fields:
function-grep/src/filter.rs#L157
warning: manual `Debug` impl does not include all fields
--> function-grep/src/filter.rs:157:1
|
157 | / impl<Supports: std::fmt::Debug> std::fmt::Debug for InstantiatedFilter<Supports> {
158 | | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
159 | | f.debug_struct("InstantiatedFilter")
160 | | .field("filter_information", &self.filter_information)
... |
163 | | }
| |_^
|
note: this field is unused
--> function-grep/src/filter.rs:138:5
|
138 | filter_function: FilterFunction,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: consider including all fields in this `Debug` impl
= help: consider calling `.finish_non_exhaustive()` if you intend to ignore fields
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_fields_in_debug
= note: `#[warn(clippy::missing_fields_in_debug)]` implied by `#[warn(clippy::pedantic)]`
|
re-implementing `PartialEq::ne` is unnecessary:
function-grep/src/filter.rs#L146
warning: re-implementing `PartialEq::ne` is unnecessary
--> function-grep/src/filter.rs:146:5
|
146 | / fn ne(&self, other: &Self) -> bool {
147 | | !self.eq(other)
148 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_ne_impl
= note: `#[warn(clippy::partialeq_ne_impl)]` on by default
|
docs for function returning `Result` missing `# Errors` section:
function-grep/src/filter.rs#L47
warning: docs for function returning `Result` missing `# Errors` section
--> function-grep/src/filter.rs:47:5
|
47 | fn to_filter(&self, s: &str) -> Result<InstantiatedFilter<Self::Supports>, String> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
|
docs for function returning `Result` missing `# Errors` section:
function-grep/src/filter.rs#L45
warning: docs for function returning `Result` missing `# Errors` section
--> function-grep/src/filter.rs:45:5
|
45 | fn parse_filter(&self, s: &str) -> Result<FilterFunction, String>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
= note: `#[warn(clippy::missing_errors_doc)]` implied by `#[warn(clippy::pedantic)]`
|
matching over `()` is more explicit:
function-grep/src/filter/general_filters.rs#L167
warning: matching over `()` is more explicit
--> function-grep/src/filter/general_filters.rs:167:21
|
167 | Err(_) => false,
| ^ help: use `()` instead of `_`: `()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
note: the lint level is defined here
--> function-grep/src/lib.rs:5:9
|
5 | #![warn(clippy::pedantic, clippy::nursery, clippy::cargo)]
| ^^^^^^^^^^^^^^^^
= note: `#[warn(clippy::ignored_unit_patterns)]` implied by `#[warn(clippy::pedantic)]`
|
this expression creates a reference which is immediately dereferenced by the compiler:
function-grep/src/filter/general_filters.rs#L164
warning: this expression creates a reference which is immediately dereferenced by the compiler
--> function-grep/src/filter/general_filters.rs:164:30
|
164 | .matches(&query, *node, text_provider)
| ^^^^^^ help: change this to: `query`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
= note: `#[warn(clippy::needless_borrow)]` on by default
|
function call inside of `or_insert`:
function-grep/src/filter/general_filters.rs#L161
warning: function call inside of `or_insert`
--> function-grep/src/filter/general_filters.rs:161:18
|
161 | .or_insert(Query::new(language, &query).map_err(|_| ()))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_insert_with(|| Query::new(language, &query).map_err(|_| ()))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call
= note: `#[warn(clippy::or_fun_call)]` implied by `#[warn(clippy::nursery)]`
|
use Option::map_or instead of an if let/else:
function-grep/src/filter/general_filters.rs#L159
warning: use Option::map_or instead of an if let/else
--> function-grep/src/filter/general_filters.rs:159:13
|
159 | / match languages
160 | | .entry(language.clone())
161 | | .or_insert(Query::new(language, &query).map_err(|_| ()))
... |
167 | | Err(_) => false,
168 | | }
| |_____________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_if_let_else
note: the lint level is defined here
--> function-grep/src/lib.rs:5:27
|
5 | #![warn(clippy::pedantic, clippy::nursery, clippy::cargo)]
| ^^^^^^^^^^^^^^^
= note: `#[warn(clippy::option_if_let_else)]` implied by `#[warn(clippy::nursery)]`
help: try
|
159 ~ languages
160 + .entry(language.clone())
161 + .or_insert(Query::new(language, &query).map_err(|_| ())).as_mut().map_or(false, |query| cursor
162 + .matches(&query, *node, text_provider)
163 + .next()
164 + .is_some())
|
|
unused macro definition: `default_filters`:
function-grep/src/filter.rs#L213
warning: unused macro definition: `default_filters`
--> function-grep/src/filter.rs:213:14
|
213 | macro_rules! default_filters {
| ^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_macros)]` on by default
|
unused import: `HashSet`:
function-grep/src/filter/general_filters.rs#L1
warning: unused import: `HashSet`
--> function-grep/src/filter/general_filters.rs:1:33
|
1 | use std::collections::{HashMap, HashSet};
| ^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
|
test
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
|
clippy_check
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
|