fix some problems with is_in_one_of_ranges and updating the code: #86
Annotations
13 errors and 17 warnings
`todo` should not be present in production code:
src/parser/parse_from_text/link_element.rs#L376
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
|
used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`:
src/parser/parse_from_text/link_element.rs#L375
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
|
slicing may panic:
src/parser/parse_from_text/link_element.rs#L361
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
|
indexing into a string may panic if the index is within a UTF-8 character:
src/parser/parse_from_text/link_element.rs#L361
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
|
integer arithmetic detected:
src/parser/parse_from_text/link_element.rs#L360
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
|
slicing may panic:
src/parser/parse_from_text/link_element.rs#L254
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
|
indexing into a string may panic if the index is within a UTF-8 character:
src/parser/parse_from_text/link_element.rs#L254
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
|
integer arithmetic detected:
src/parser/parse_from_text/link_element.rs#L252
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
|
slicing may panic:
src/parser/parse_from_text/link_element.rs#L220
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
|
indexing into a string may panic if the index is within a UTF-8 character:
src/parser/parse_from_text/link_element.rs#L220
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
|
integer arithmetic detected:
src/parser/parse_from_text/link_element.rs#L219
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
|
indexing may panic:
src/parser/parse_from_text/find_range.rs#L28
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
|
test
Process completed with exit code 101.
|
length comparison to zero:
src/parser/parse_from_text/link_element.rs#L367
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
|
use of `char::is_digit` with literal radix of 10:
src/parser/parse_from_text/link_element.rs#L31
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
|
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#L23
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
|
associated function `parse_standalone_with_whitelist` is never used:
src/parser/link_url.rs#L68
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(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
function `is_allowed_generic_scheme` is never used:
src/parser/link_url.rs#L47
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 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
function `not_link_part_char` is never used:
src/parser/parse_from_text/text_elements.rs#L99
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 {
| ^^^^^^^^^^^^^^^^^^
|
function `parse_irelative_ref` is never used:
src/parser/parse_from_text/link_element.rs#L375
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>> {
| ^^^^^^^^^^^^^^^^^^^
|
function `is_userinfo_not_pct_encoded` is never used:
src/parser/parse_from_text/link_element.rs#L208
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 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
function `is_ipv4` is never used:
src/parser/parse_from_text/link_element.rs#L84
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
|
unused variable: `input`:
src/parser/parse_from_text/link_element.rs#L375
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`
|
unused variable: `input_`:
src/parser/parse_from_text/link_element.rs#L353
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
|
unreachable pattern:
src/parser/parse_from_text/link_element.rs#L68
warning: unreachable pattern
--> src/parser/parse_from_text/link_element.rs:68:29
|
68 | matches!(c, '_' | '.' | '_' | '~')
| ^^^
|
= note: `#[warn(unreachable_patterns)]` on by default
|
unused import: `super::base_parsers::*`:
src/parser/parse_from_text/text_elements.rs#L5
warning: unused import: `super::base_parsers::*`
--> src/parser/parse_from_text/text_elements.rs:5:5
|
5 | use super::base_parsers::*;
| ^^^^^^^^^^^^^^^^^^^^^^
|
unused import: `crate::parser::link_url::LinkDestination`:
src/parser/parse_from_text/text_elements.rs#L2
warning: unused import: `crate::parser::link_url::LinkDestination`
--> src/parser/parse_from_text/text_elements.rs:2:5
|
2 | use crate::parser::link_url::LinkDestination;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
unused imports: `direct_delimited`, `is_white_space_but_not_linebreak`, `is_white_space`:
src/parser/parse_from_text/desktop_subset.rs#L6
warning: unused imports: `direct_delimited`, `is_white_space_but_not_linebreak`, `is_white_space`
--> src/parser/parse_from_text/desktop_subset.rs:6:5
|
6 | direct_delimited, is_white_space, is_white_space_but_not_linebreak, CustomError,
| ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
test
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v2. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
test
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|