Skip to content

[function-grep]

[function-grep] #625

GitHub Actions / clippy succeeded Dec 6, 2024 in 0s

clippy

23 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 23
Note 0
Help 0

Versions

  • rustc 1.83.0 (90b35a623 2024-11-26)
  • cargo 1.83.0 (5ffbef321 2024-10-29)
  • clippy 0.1.83 (90b35a6 2024-11-26)

Annotations

Check warning on line 554 in git-function-history-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this `map_or` can be simplified

warning: this `map_or` can be simplified
   --> git-function-history-lib/src/lib.rs:552:5
    |
552 | /     filename
553 | |         .extension()
554 | |         .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
    |
552 ~     filename
553 +         .extension().is_some_and(|ext| ext.eq_ignore_ascii_case(file_ext))
    |

Check warning on line 538 in git-function-history-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this argument is passed by value, but not consumed in the function body

warning: this argument is passed by value, but not consumed in the function body
   --> git-function-history-lib/src/lib.rs:538:12
    |
538 |     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

Check warning on line 338 in git-function-history-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this argument is passed by value, but not consumed in the function body

warning: this argument is passed by value, but not consumed in the function body
   --> git-function-history-lib/src/lib.rs:338:11
    |
338 |     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

Check warning on line 323 in git-function-history-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this argument is passed by value, but not consumed in the function body

warning: this argument is passed by value, but not consumed in the function body
   --> git-function-history-lib/src/lib.rs:323:11
    |
323 |     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)]`

Check warning on line 144 in git-function-history-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function which may panic missing `# Panics` section

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

Check warning on line 84 in git-function-history-lib/src/types.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function which may panic missing `# Panics` section

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)]`

Check warning on line 15 in git-function-history-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

empty line after doc comment

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 | ///
   |

Check warning on line 557 in git-function-history-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

trait `UnwrapToError` is never used

warning: trait `UnwrapToError` is never used
   --> git-function-history-lib/src/lib.rs:557:7
    |
557 | trait UnwrapToError<T> {
    |       ^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

Check warning on line 18 in git-function-history-lib/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused macro definition: `get_item_from`

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

Check warning on line 85 in function-grep/src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

first doc comment paragraph is too long

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)]`

Check warning on line 232 in function-grep/src/supported_languages.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

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

Check warning on line 222 in function-grep/src/supported_languages.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

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

Check warning on line 218 in function-grep/src/supported_languages.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

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

Check warning on line 203 in function-grep/src/supported_languages.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

called `map(<f>).unwrap_or_else(<g>)` on a `Result` value

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)]`

Check warning on line 153 in function-grep/src/supported_languages.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

some fields in `TagsConfigurationThreadSafe` are not safe to be sent to another thread

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: the lint level is defined here
   --> function-grep/src/lib.rs:5:27
    |
5   | #![warn(clippy::pedantic, clippy::nursery, clippy::cargo)]
    |                           ^^^^^^^^^^^^^^^
    = note: `#[warn(clippy::non_send_fields_in_send_ty)]` implied by `#[warn(clippy::nursery)]`

Check warning on line 359 in function-grep/src/filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
   --> function-grep/src/filter.rs:359:5
    |
359 |     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

Check warning on line 355 in function-grep/src/filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

method `default` can be confused for the standard trait method `std::default::Default::default`

warning: method `default` can be confused for the standard trait method `std::default::Default::default`
   --> function-grep/src/filter.rs:315:5
    |
315 | /     pub fn default() -> Self {
316 | |         Self {
317 | |             filters: HashMap::from([
318 | |                 (
...   |
354 | |         }
355 | |     }
    | |_____^
    |
    = 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

Check warning on line 263 in function-grep/src/filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
   --> function-grep/src/filter.rs:263:5
    |
263 |     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

Check warning on line 162 in function-grep/src/filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

manual `Debug` impl does not include all fields

warning: manual `Debug` impl does not include all fields
   --> function-grep/src/filter.rs:156:1
    |
156 | / impl<Supports: std::fmt::Debug> std::fmt::Debug for InstantiatedFilter<Supports> {
157 | |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
158 | |         f.debug_struct("InstantiatedFilter")
159 | |             .field("filter_information", &self.filter_information)
160 | |             .finish()
161 | |     }
162 | | }
    | |_^
    |
note: this field is unused
   --> function-grep/src/filter.rs:137:5
    |
137 |     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)]`

Check warning on line 147 in function-grep/src/filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

re-implementing `PartialEq::ne` is unnecessary

warning: re-implementing `PartialEq::ne` is unnecessary
   --> function-grep/src/filter.rs:145:5
    |
145 | /     fn ne(&self, other: &Self) -> bool {
146 | |         !self.eq(other)
147 | |     }
    | |_____^
    |
    = 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

Check warning on line 46 in function-grep/src/filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> function-grep/src/filter.rs:46:5
   |
46 |     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

Check warning on line 44 in function-grep/src/filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
  --> function-grep/src/filter.rs:44:5
   |
44 |     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: the lint level is defined here
  --> function-grep/src/lib.rs:5:9
   |
5  | #![warn(clippy::pedantic, clippy::nursery, clippy::cargo)]
   |         ^^^^^^^^^^^^^^^^
   = note: `#[warn(clippy::missing_errors_doc)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 212 in function-grep/src/filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused macro definition: `default_filters`

warning: unused macro definition: `default_filters`
   --> function-grep/src/filter.rs:212:14
    |
212 | macro_rules! default_filters {
    |              ^^^^^^^^^^^^^^^
    |
    = note: `#[warn(unused_macros)]` on by default