Fixed single character patterns using double quotes

This commit is contained in:
Riley-Kilgore
2024-09-24 08:32:41 -07:00
committed by Lucas
parent 9a29f4e876
commit 7c6f3278ba
3 changed files with 8 additions and 8 deletions

View File

@@ -173,8 +173,8 @@ fn generate_module(
let comment = Comment::from((span, module.code.as_str()))
.content
.trim_start();
if comment.starts_with("#") {
let trimmed = comment.trim_start_matches("#");
if comment.starts_with('#') {
let trimmed = comment.trim_start_matches('#');
let heading = comment.len() - trimmed.len();
Some((
span,

View File

@@ -64,8 +64,8 @@ impl LinkTree {
/// Strip prefix and ensures to remove any leading slash "/" as well.
fn strip_prefix(source: &str, prefix: &str) -> String {
let result = source.strip_prefix(prefix).unwrap();
if result.starts_with("/") {
result.strip_prefix("/").unwrap().to_string()
if result.starts_with('/') {
result.strip_prefix('/').unwrap().to_string()
} else {
result.to_string()
}
@@ -206,10 +206,10 @@ impl LinkTree {
LinkTree::Empty => vec![],
LinkTree::Leaf { value } => {
let last_ix = value.split("/").count();
let last_ix = value.split('/').count();
let module_path = mk_path(value);
value
.split("/")
.split('/')
.enumerate()
.map(|(offset, segment)| {
if offset == last_ix - 1 {