Skip to content

Commit

Permalink
fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
untitaker committed Oct 25, 2024
1 parent ebbf40d commit 4305f1f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl<P: Copy> LinkState<P> {
LinkState::Defined => (),
LinkState::Undefined(links) => match other {
LinkState::Defined => *self = LinkState::Defined,
LinkState::Undefined(links2) => links.extend(links2.into_iter()),
LinkState::Undefined(links2) => links.extend(links2),
},
}
}
Expand All @@ -82,19 +82,19 @@ pub struct LocalLinksOnly<C> {

pub fn canonicalize_local_link<'a, P>(arena: &Bump, mut link: Link<'a, P>) -> Option<Link<'a, P>> {
if let Link::Uses(ref mut used_link) = link {
if is_external_link(&used_link.href.0.as_bytes()) {
if is_external_link(used_link.href.0.as_bytes()) {
return None;
}

let qs_start = used_link
.href
.0
.find(&['?', '#'][..])
.unwrap_or_else(|| used_link.href.0.len());
.unwrap_or(used_link.href.0.len());

// try calling canonicalize
let path = used_link.path.to_str().unwrap_or("");
let mut href = BumpString::from_str_in(path, &arena);
let mut href = BumpString::from_str_in(path, arena);
push_and_canonicalize(
&mut href,
&try_percent_decode(&used_link.href.0[..qs_start]),
Expand Down
2 changes: 1 addition & 1 deletion src/urls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub fn is_external_link(url: &[u8]) -> bool {
// check if string before first : is a valid URL scheme
// see RFC 2396, Appendix A for what constitutes a valid scheme

if !matches!(first_char, b'a'..=b'z' | b'A'..=b'Z') {
if !first_char.is_ascii_alphabetic() {
return false;
}

Expand Down

0 comments on commit 4305f1f

Please sign in to comment.