Skip to content

Commit 3839987

Browse files
committed
Add has_url()
1 parent bc31014 commit 3839987

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/comment.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,12 @@ fn rewrite_comment_inner(
349349
Some(result)
350350
}
351351

352+
/// Returns true if the given string MAY include URLs or alike.
353+
fn has_url(s: &str) -> bool {
354+
// This function may return false positive, but should get its job done in most cases.
355+
s.contains("https://") || s.contains("http://")
356+
}
357+
352358
/// Given the span, rewrite the missing comment inside it if available.
353359
/// Note that the given span must only include comments (or leading/trailing whitespaces).
354360
pub fn rewrite_missing_comment(

0 commit comments

Comments
 (0)