Skip to content

More work on representing filter where its different for different #609

More work on representing filter where its different for different

More work on representing filter where its different for different #609

GitHub Actions / clippy failed Nov 11, 2024 in 1s

clippy

6 errors, 21 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 6
Warning 21
Note 0
Help 0

Versions

  • rustc 1.82.0 (f6e511eec 2024-10-15)
  • cargo 1.82.0 (8f40fc59f 2024-08-21)
  • clippy 0.1.82 (f6e511e 2024-10-15)

Annotations

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

See this annotation in the file changed.

@github-actions github-actions / clippy

this argument is a mutable reference, but not used mutably

warning: this argument is a mutable reference, but not used mutably
   --> function-grep/src/filter.rs:285:15
    |
285 |     hash_map: &mut HashMap<String, &'a dyn Filter<Supports = Language>>,
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&HashMap<String, &'a dyn Filter<Supports = Language>>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
    = note: `#[warn(clippy::needless_pass_by_ref_mut)]` implied by `#[warn(clippy::nursery)]`

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

Check warning on line 263 in function-grep/src/supported_languages.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/supported_languages.rs:257:1
    |
257 | / /// Use to more easily make new [`SupportedLanguage`]s.
258 | | /// First provide the name (which is used as the type of the language), followed by the tree sitter
259 | | /// languge in parenthesis, next you put the file extensions in brackets with a leading .
260 | | /// to specify the query we use ?= variable -> string literal query.
261 | | /// In the query you when you want use the variable just do {variable}.
262 | | ///
263 | | /// Example:
    | |_
    |
    = 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)]`
help: add an empty line
    |
257 ~ /// Use to more easily make new [`SupportedLanguage`]s.
258 + ///
    |

Check warning on line 205 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:205:5
    |
205 |     fn instantiate_map(self, name: &'a str) -> Result<Vec<InstantiatedLanguage<'a>>, QueryError>;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check failure on line 169 in function-grep/src/supported_languages.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
   --> function-grep/src/supported_languages.rs:167:24
    |
167 |               let tags = tag_config
    |  ________________________^
168 | |                 .generate_tags(&mut tag_context, code, None)
169 | |                 .unwrap()
    | |_________________________^
    |
    = note: if this value is an `Err`, it will panic
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used

Check failure on line 161 in function-grep/src/supported_languages.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
   --> function-grep/src/supported_languages.rs:161:13
    |
161 |             TagsConfiguration::new(self.language(), &self.tag_query().to_string(), "").unwrap(),
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: if this value is an `Err`, it will panic
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used

Check warning on line 137 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:137:1
    |
137 | unsafe impl Send for TagsConfigurationThreadSafe {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: it is not safe to send field `0` to another thread
   --> function-grep/src/supported_languages.rs:136:36
    |
136 | 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)]`

Check failure on line 126 in function-grep/src/supported_languages.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
   --> function-grep/src/supported_languages.rs:122:21
    |
122 |           let query = Query::new(
    |  _____________________^
123 | |             &self.language(),
124 | |             &self.query_string_function(search.as_ref()),
125 | |         )
126 | |         .unwrap();
    | |_________________^
    |
    = note: if this value is an `Err`, it will panic
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used

Check failure on line 112 in function-grep/src/supported_languages.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
   --> function-grep/src/supported_languages.rs:112:61
    |
112 |                         .any(|c| c.index == method_field && c.node.utf8_text(code).unwrap() == name)
    |                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: if this value is an `Err`, it will panic
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used

Check failure on line 103 in function-grep/src/supported_languages.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on an `Option` value

error: used `unwrap()` on an `Option` value
   --> function-grep/src/supported_languages.rs:101:28
    |
101 |           let method_field = query
    |  ____________________________^
102 | |             .capture_index_for_name(&self.query_name().to_string())
103 | |             .unwrap();
    | |_____________________^
    |
    = note: if this value is `None`, it will panic
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used

Check failure on line 100 in function-grep/src/supported_languages.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unwrap()` on a `Result` value

error: used `unwrap()` on a `Result` value
   --> function-grep/src/supported_languages.rs:100:21
    |
100 |         let query = Query::new(&self.language(), &self.query_string().to_string()).unwrap();
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: if this value is an `Err`, it will panic
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used
note: the lint level is defined here
   --> function-grep/src/lib.rs:2:9
    |
2   | #![deny(clippy::unwrap_used, clippy::expect_used)]
    |         ^^^^^^^^^^^^^^^^^^^

Check warning on line 286 in function-grep/src/filter.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
   --> function-grep/src/filter.rs:286:13
    |
286 |     filter: FilterType<'a>,
    |             ^^^^^^^^^^^^^^ help: consider taking a reference instead: `&FilterType<'a>`
    |
    = 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 279 in function-grep/src/filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> function-grep/src/filter.rs:270:13
    |
270 | /             match this {
271 | |                 Some(filters) => match filters {
272 | |                     FilterType::All(_) => Err("cannot add to an all filter".to_string()),
273 | |                     FilterType::Many(Many { filters, .. }) => merge_filters(filters, filter),
...   |
278 | |                 }
279 | |             }
    | |_____________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
    = note: `#[warn(clippy::single_match_else)]` implied by `#[warn(clippy::pedantic)]`
help: try
    |
270 ~             if let Some(filters) = this { match filters {
271 +                 FilterType::All(_) => Err("cannot add to an all filter".to_string()),
272 +                 FilterType::Many(Many { filters, .. }) => merge_filters(filters, filter),
273 +             } } else {
274 +                 self.filters.insert(name, filter);
275 +                 Ok(())
276 +             }
    |

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

See this annotation in the file changed.

@github-actions github-actions / clippy

redundant clone

warning: redundant clone
   --> function-grep/src/filter.rs:267:40
    |
267 |         let name = filter.filter_name().clone();
    |                                        ^^^^^^^^ help: remove this
    |
note: this value is dropped without further use
   --> function-grep/src/filter.rs:267:20
    |
267 |         let name = filter.filter_name().clone();
    |                    ^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone
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::redundant_clone)]` implied by `#[warn(clippy::nursery)]`

Check warning on line 265 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:265:5
    |
265 |     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 229 in function-grep/src/filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this method could have a `#[must_use]` attribute

warning: this method could have a `#[must_use]` attribute
   --> function-grep/src/filter.rs:229:5
    |
229 |     pub fn default() -> Self {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] pub fn default() -> Self`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate
    = note: `#[warn(clippy::must_use_candidate)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 261 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:229:5
    |
229 | /     pub fn default() -> Self {
230 | |         Self {
231 | |             filters: HashMap::from([
232 | |                 (
...   |
260 | |         }
261 | |     }
    | |_____^
    |
    = 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 213 in function-grep/src/filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a
   --> function-grep/src/filter.rs:213:6
    |
213 | impl<'a> FilterType<'a> {
    |      ^^             ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
    |
213 - impl<'a> FilterType<'a> {
213 + impl FilterType<'_> {
    |

Check warning on line 156 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:150:1
    |
150 | / impl std::fmt::Debug for InstantiatedFilter {
151 | |     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
152 | |         f.debug_struct("InstantiatedFilter")
153 | |             .field("filter_information", &self.filter_information)
154 | |             .finish()
155 | |     }
156 | | }
    | |_^
    |
note: this field is unused
   --> function-grep/src/filter.rs:135:5
    |
135 |     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 39 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:39:5
   |
39 |     fn to_filter(&self, s: &str) -> Result<InstantiatedFilter, String> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc

Check warning on line 37 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:37:5
   |
37 |     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 218 in function-grep/src/filter.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

method `supports` is never used

warning: method `supports` is never used
   --> function-grep/src/filter.rs:218:8
    |
213 | impl<'a> FilterType<'a> {
    | ----------------------- method in this implementation
...
218 |     fn supports(&self) -> SupportedLanguages {
    |        ^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

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

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `filter`

warning: unused variable: `filter`
   --> function-grep/src/filter.rs:286:5
    |
286 |     filter: FilterType<'a>,
    |     ^^^^^^ help: if this is intentional, prefix it with an underscore: `_filter`

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

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `hash_map`

warning: unused variable: `hash_map`
   --> function-grep/src/filter.rs:285:5
    |
285 |     hash_map: &mut HashMap<String, &'a dyn Filter<Supports = Language>>,
    |     ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_hash_map`

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

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `s`

warning: unused variable: `s`
   --> function-grep/src/filter/general_filters.rs:139:28
    |
139 |     fn parse_filter(&self, s: &str) -> Result<FilterFunction, String> {
    |                            ^ help: if this is intentional, prefix it with an underscore: `_s`
    |
    = note: `#[warn(unused_variables)]` on by default