Skip to content

Commit

Permalink
fix loop...
Browse files Browse the repository at this point in the history
  • Loading branch information
farooqkz committed Mar 17, 2024
1 parent 54a9bde commit d024101
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/parser/link_url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ fn is_sub_delim(c: char) -> bool {
// Here again, order is important. As URLs/IRIs have letters in them
// most of the time and less digits or other characters. --Farooq
fn is_scheme(c: char) -> bool {
is_alpha(c) || is_digit(c) || is_scheme(c)
is_alpha(c) || is_digit(c) || is_other_scheme(c)
}

fn is_other_scheme(c: char) -> bool {
matches!(c, '+' | '-' | '.')
}

fn ipv4(input: &str) -> IResult<&str, &str, CustomError<&str>> {
Expand Down Expand Up @@ -381,7 +385,7 @@ fn take_while_ifragment(input: &str) -> IResult<&str, &str, CustomError<&str>> {
}

fn scheme(input: &str) -> IResult<&str, &str, CustomError<&str>> {
take_while(is_scheme)(input)
recognize(tuple((take_while_m_n(1, 1, is_alpha), take_while(is_scheme)))(input)

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Rustfmt

mismatched closing delimiter: `}`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Rustfmt

mismatched closing delimiter: `}`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Rustfmt

mismatched closing delimiter: `}`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Rustfmt

mismatched closing delimiter: `}`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Rustfmt

mismatched closing delimiter: `}`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Rustfmt

mismatched closing delimiter: `}`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Rustfmt

mismatched closing delimiter: `}`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Rustfmt

mismatched closing delimiter: `}`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Rustfmt

mismatched closing delimiter: `}`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Rustfmt

mismatched closing delimiter: `}`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Rust doc comments

mismatched closing delimiter: `}`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / clippy

expected a `std::ops::FnMut<(_,)>` closure, found `std::result::Result<(&str, (&str, &str)), nom::Err<_>>`

error[E0277]: expected a `std::ops::FnMut<(_,)>` closure, found `std::result::Result<(&str, (&str, &str)), nom::Err<_>>` --> src/parser/link_url.rs:388:15 | 388 | recognize(tuple((take_while_m_n(1, 1, is_alpha), take_while(is_scheme)))(input) | --------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `FnMut<(_,)>` closure, found `std::result::Result<(&str, (&str, &str)), nom::Err<_>>` | | | required by a bound introduced by this call | = help: the trait `std::ops::FnMut<(_,)>` is not implemented for `std::result::Result<(&str, (&str, &str)), nom::Err<_>>` = help: the following other types implement trait `nom::Parser<I, O, E>`: <nom::And<F, G> as nom::Parser<I, (O1, O2), E>> <nom::AndThen<F, G, O1> as nom::Parser<I, O2, E>> <nom::FlatMap<F, G, O1> as nom::Parser<I, O2, E>> <nom::Into<F, O1, O2, E1, E2> as nom::Parser<I, O2, E2>> <nom::Map<F, G, O1> as nom::Parser<I, O2, E>> <nom::Or<F, G> as nom::Parser<I, O, E>> <std::boxed::Box<(dyn nom::Parser<I, O, E> + 'a)> as nom::Parser<I, O, E>> = note: required because of the requirements on the impl of `nom::Parser<_, _, _>` for `std::result::Result<(&str, (&str, &str)), nom::Err<_>>` note: required by a bound in `nom::combinator::recognize` --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/nom-7.1.3/src/combinator/mod.rs:510:6 | 510 | F: Parser<I, O, E>, | ^^^^^^^^^^^^^^^ required by this bound in `nom::combinator::recognize`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Build and test (ubuntu-latest, 1.64.0)

mismatched closing delimiter: `}`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Build and test (ubuntu-latest, 1.64.0)

expected a `FnMut<(_,)>` closure, found `Result<(&str, (&str, &str)), nom::Err<_>>`

Check failure on line 388 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / Build and test (ubuntu-latest, 1.64.0)

mismatched types
}

Check failure on line 389 in src/parser/link_url.rs

View workflow job for this annotation

GitHub Actions / clippy

mismatched types

error[E0308]: mismatched types --> src/parser/link_url.rs:388:5 | 387 | fn scheme(input: &str) -> IResult<&str, &str, CustomError<&str>> { | -------------------------------------- expected `std::result::Result<(&str, &str), nom::Err<parser::parse_from_text::base_parsers::CustomError<&str>>>` because of return type 388 | / recognize(tuple((take_while_m_n(1, 1, is_alpha), take_while(is_scheme)))(input) 389 | | } | |_^ expected enum `std::result::Result`, found opaque type | ::: /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/nom-7.1.3/src/combinator/mod.rs:508:6 | 508 | ) -> impl FnMut(I) -> IResult<I, I, E> | --------------------------------- the found opaque type | = note: expected enum `std::result::Result<(&str, &str), nom::Err<parser::parse_from_text::base_parsers::CustomError<&str>>>` found opaque type `impl FnMut(_) -> std::result::Result<(_, _), nom::Err<_>>` help: use parentheses to call this closure | 389 | }(_) | +++

fn take_while_pct_encoded(input: &str) -> IResult<&str, &str, CustomError<&str>> {
Expand Down

0 comments on commit d024101

Please sign in to comment.