X-Git-Url: https://git.r.bdr.sh/rbdr/page/blobdiff_plain/8766e4412b95cfa0288683748cc20aba81a64d08..4d946aebe3f70ad18e235d68474b6d489757c927:/src/gemini_parser.rs diff --git a/src/gemini_parser.rs b/src/gemini_parser.rs index 49d954a..f7aa0cc 100644 --- a/src/gemini_parser.rs +++ b/src/gemini_parser.rs @@ -82,7 +82,7 @@ mod tests { parse_line("# Heading"), GeminiLine::Heading(1, " Heading".to_string()) ); - assert_eq!(parse_line("###"), GeminiLine::Heading(3, "".to_string())); + assert_eq!(parse_line("###"), GeminiLine::Heading(3, String::new())); assert_eq!( parse_line("#####"), GeminiLine::Heading(3, "##".to_string()) @@ -111,16 +111,16 @@ mod tests { ); assert_eq!( parse_line("=> /local/path"), - GeminiLine::Link("/local/path".to_string(), "".to_string()) + GeminiLine::Link("/local/path".to_string(), String::new()) ); assert_eq!( parse_line("=>"), - GeminiLine::Link("".to_string(), "".to_string()) + GeminiLine::Link(String::new(), String::new()) ); assert_eq!( parse_line("=> "), - GeminiLine::Link("".to_string(), "".to_string()) + GeminiLine::Link(String::new(), String::new()) ); assert_eq!( parse_line("=> multiple spaces in text"), @@ -140,7 +140,7 @@ mod tests { GeminiLine::ListItem("List item".to_string()) ); - assert_eq!(parse_line("* "), GeminiLine::ListItem("".to_string())); + assert_eq!(parse_line("* "), GeminiLine::ListItem(String::new())); assert_eq!(parse_line("*"), GeminiLine::Text("*".to_string(), false)); assert_eq!( parse_line("*WithText"), @@ -159,7 +159,7 @@ mod tests { GeminiLine::Quote("Quote text".to_string()) ); - assert_eq!(parse_line(">"), GeminiLine::Quote("".to_string())); + assert_eq!(parse_line(">"), GeminiLine::Quote(String::new())); assert_eq!(parse_line("> "), GeminiLine::Quote(" ".to_string())); assert_eq!( parse_line(">>Nested"), @@ -176,7 +176,7 @@ mod tests { assert_eq!( parse_line("```"), - GeminiLine::PreformattedToggle(true, "".to_string()) + GeminiLine::PreformattedToggle(true, String::new()) ); assert_eq!( parse_line("``` "), @@ -189,11 +189,11 @@ mod tests { assert_eq!( parse_preformatted_line("```alt-text"), - GeminiLine::PreformattedToggle(false, "".to_string()) + GeminiLine::PreformattedToggle(false, String::new()) ); assert_eq!( parse_preformatted_line("```"), - GeminiLine::PreformattedToggle(false, "".to_string()) + GeminiLine::PreformattedToggle(false, String::new()) ); } @@ -206,7 +206,7 @@ mod tests { ); // Edge cases - assert_eq!(parse_line(""), GeminiLine::Text("".to_string(), false)); + assert_eq!(parse_line(""), GeminiLine::Text(String::new(), false)); assert_eq!(parse_line(" "), GeminiLine::Text(" ".to_string(), false)); assert_eq!(parse_line(" "), GeminiLine::Text(" ".to_string(), false)); } @@ -265,7 +265,7 @@ code GeminiLine::Text("=> https://example.com Link text".to_string(), true), GeminiLine::Text("* List item".to_string(), true), GeminiLine::Text(">Quote".to_string(), true), - GeminiLine::PreformattedToggle(false, "".to_string()), + GeminiLine::PreformattedToggle(false, String::new()), ] ); }