Skip to content

fix some problems with is_in_one_of_ranges and updating the code:

Sign in for the full log view
GitHub Actions / clippy failed Mar 12, 2024 in 1s

clippy

12 errors, 15 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 12
Warning 15
Note 0
Help 0

Versions

  • rustc 1.64.0 (a55dd71d5 2022-09-19)
  • cargo 1.64.0 (387270bc7 2022-09-16)
  • clippy 0.1.64 (a55dd71 2022-09-19)

Annotations

Check failure on line 376 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

`todo` should not be present in production code

error: `todo` should not be present in production code
   --> src/parser/parse_from_text/link_element.rs:376:5
    |
376 |     todo!()
    |     ^^^^^^^
    |
note: the lint level is defined here
   --> src/lib.rs:30:5
    |
30  |     clippy::todo,
    |     ^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#todo

Check failure on line 377 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`

error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
   --> src/parser/parse_from_text/link_element.rs:375:1
    |
375 | / fn parse_irelative_ref(input: &str) -> IResult<&str, Element, CustomError<&str>> {
376 | |     todo!()
377 | | }
    | |_^
    |
note: the lint level is defined here
   --> src/lib.rs:27:5
    |
27  |     clippy::panic_in_result_fn,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
note: return Err() instead of panicking
   --> src/parser/parse_from_text/link_element.rs:376:5
    |
376 |     todo!()
    |     ^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#panic_in_result_fn

Check warning on line 367 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

length comparison to zero

warning: length comparison to zero
   --> src/parser/parse_from_text/link_element.rs:367:30
    |
367 |                 hostname: if host.len() == 0 { None } else { Some(host) },
    |                              ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `host.is_empty()`
    |
    = note: `#[warn(clippy::len_zero)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero

Check failure on line 361 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

slicing may panic

error: slicing may panic
   --> src/parser/parse_from_text/link_element.rs:361:17
    |
361 |     let link = &input_[0..len];
    |                 ^^^^^^^^^^^^^^
    |
    = help: consider using `.get(n..m)` or `.get_mut(n..m)` instead
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#indexing_slicing

Check failure on line 361 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

indexing into a string may panic if the index is within a UTF-8 character

error: indexing into a string may panic if the index is within a UTF-8 character
   --> src/parser/parse_from_text/link_element.rs:361:17
    |
361 |     let link = &input_[0..len];
    |                 ^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#string_slice

Check failure on line 360 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

integer arithmetic detected

error: integer arithmetic detected
   --> src/parser/parse_from_text/link_element.rs:360:15
    |
360 |     let len = scheme.len() + ihier.len() + query.len() + fragment.len();
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#integer_arithmetic

Check failure on line 254 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

slicing may panic

error: slicing may panic
   --> src/parser/parse_from_text/link_element.rs:254:18
    |
254 |     Ok((input, (&i[0..len], host, is_ipv6_or_future)))
    |                  ^^^^^^^^^
    |
    = help: consider using `.get(n..m)` or `.get_mut(n..m)` instead
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#indexing_slicing

Check failure on line 254 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

indexing into a string may panic if the index is within a UTF-8 character

error: indexing into a string may panic if the index is within a UTF-8 character
   --> src/parser/parse_from_text/link_element.rs:254:18
    |
254 |     Ok((input, (&i[0..len], host, is_ipv6_or_future)))
    |                  ^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#string_slice

Check failure on line 252 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

integer arithmetic detected

error: integer arithmetic detected
   --> src/parser/parse_from_text/link_element.rs:252:15
    |
252 |     let len = 2 + authority.len() + path.len();
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#integer_arithmetic

Check failure on line 220 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

slicing may panic

error: slicing may panic
   --> src/parser/parse_from_text/link_element.rs:220:18
    |
220 |     Ok((input, (&i[0..len], host, is_ipv6_or_future)))
    |                  ^^^^^^^^^
    |
    = help: consider using `.get(n..m)` or `.get_mut(n..m)` instead
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#indexing_slicing

Check failure on line 220 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

indexing into a string may panic if the index is within a UTF-8 character

error: indexing into a string may panic if the index is within a UTF-8 character
   --> src/parser/parse_from_text/link_element.rs:220:18
    |
220 |     Ok((input, (&i[0..len], host, is_ipv6_or_future)))
    |                  ^^^^^^^^^
    |
note: the lint level is defined here
   --> src/lib.rs:20:5
    |
20  |     clippy::string_slice,
    |     ^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#string_slice

Check failure on line 219 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

integer arithmetic detected

error: integer arithmetic detected
   --> src/parser/parse_from_text/link_element.rs:219:15
    |
219 |     let len = userinfo.len() + host.len() + port.len();
    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: the lint level is defined here
   --> src/lib.rs:12:5
    |
12  |     clippy::integer_arithmetic,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#integer_arithmetic

Check warning on line 31 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `char::is_digit` with literal radix of 10

warning: use of `char::is_digit` with literal radix of 10
  --> src/parser/parse_from_text/link_element.rs:31:5
   |
31 |     c.is_digit(10)
   |     ^^^^^^^^^^^^^^ help: try: `c.is_ascii_digit()`
   |
   = note: `#[warn(clippy::is_digit_ascii_radix)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#is_digit_ascii_radix

Check failure on line 28 in src/parser/parse_from_text/find_range.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

indexing may panic

error: indexing may panic
  --> src/parser/parse_from_text/find_range.rs:28:42
   |
28 |             0 => FindRangeResult::Range(&ranges[0]),
   |                                          ^^^^^^^^^
   |
note: the lint level is defined here
  --> src/lib.rs:3:5
   |
3  |     clippy::indexing_slicing,
   |     ^^^^^^^^^^^^^^^^^^^^^^^^
   = help: consider using `.get(n)` or `.get_mut(n)` instead
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#indexing_slicing

Check warning on line 23 in src/parser/parse_from_text/find_range.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)

warning: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
  --> src/parser/parse_from_text/find_range.rs:23:1
   |
23 | fn find_range_for_char<'a>(code: u32, ranges: &'a [RangeInclusive<u32>]) -> FindRangeResult<'a> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(clippy::needless_lifetimes)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes

Check warning on line 68 in src/parser/link_url.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

associated function `parse_standalone_with_whitelist` is never used

warning: associated function `parse_standalone_with_whitelist` is never used
  --> src/parser/link_url.rs:68:19
   |
68 |     pub(crate) fn parse_standalone_with_whitelist(
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 47 in src/parser/link_url.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

function `is_allowed_generic_scheme` is never used

warning: function `is_allowed_generic_scheme` is never used
  --> src/parser/link_url.rs:47:4
   |
47 | fn is_allowed_generic_scheme(scheme: &str) -> bool {
   |    ^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 99 in src/parser/parse_from_text/text_elements.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

function `not_link_part_char` is never used

warning: function `not_link_part_char` is never used
  --> src/parser/parse_from_text/text_elements.rs:99:4
   |
99 | fn not_link_part_char(c: char) -> bool {
   |    ^^^^^^^^^^^^^^^^^^

Check warning on line 375 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

function `parse_irelative_ref` is never used

warning: function `parse_irelative_ref` is never used
   --> src/parser/parse_from_text/link_element.rs:375:4
    |
375 | fn parse_irelative_ref(input: &str) -> IResult<&str, Element, CustomError<&str>> {
    |    ^^^^^^^^^^^^^^^^^^^

Check warning on line 208 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

function `is_userinfo_not_pct_encoded` is never used

warning: function `is_userinfo_not_pct_encoded` is never used
   --> src/parser/parse_from_text/link_element.rs:208:4
    |
208 | fn is_userinfo_not_pct_encoded(c: char) -> bool {
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 84 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

function `is_ipv4` is never used

warning: function `is_ipv4` is never used
  --> src/parser/parse_from_text/link_element.rs:84:4
   |
84 | fn is_ipv4(c: char) -> bool {
   |    ^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

Check warning on line 375 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `input`

warning: unused variable: `input`
   --> src/parser/parse_from_text/link_element.rs:375:24
    |
375 | fn parse_irelative_ref(input: &str) -> IResult<&str, Element, CustomError<&str>> {
    |                        ^^^^^ help: if this is intentional, prefix it with an underscore: `_input`

Check warning on line 353 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `input_`

warning: unused variable: `input_`
   --> src/parser/parse_from_text/link_element.rs:353:9
    |
353 |     let input_ = <&str>::clone(&input);
    |         ^^^^^^ help: if this is intentional, prefix it with an underscore: `_input_`
    |
    = note: `#[warn(unused_variables)]` on by default

Check warning on line 68 in src/parser/parse_from_text/link_element.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unreachable pattern

warning: unreachable pattern
  --> src/parser/parse_from_text/link_element.rs:68:29
   |
68 |     matches!(c, '_' | '.' | '_' | '~')
   |                             ^^^
   |
   = note: `#[warn(unreachable_patterns)]` on by default

Check warning on line 5 in src/parser/parse_from_text/text_elements.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `super::base_parsers::*`

warning: unused import: `super::base_parsers::*`
 --> src/parser/parse_from_text/text_elements.rs:5:5
  |
5 | use super::base_parsers::*;
  |     ^^^^^^^^^^^^^^^^^^^^^^