Janitor: Find char, not a str

This commit is contained in:
Tobias Hunger 2021-07-08 19:39:53 +02:00 committed by Simon Hausmann
parent bf48a6c65e
commit 08a6dc02fc

View file

@ -39,7 +39,7 @@ fn generate_test(fn_name: &str, doc: &str) -> String {
Some(idx) => idx + 8, Some(idx) => idx + 8,
None => match doc.find("```test,") { None => match doc.find("```test,") {
None => return error("test not found"), None => return error("test not found"),
Some(idx) => match doc[idx..].find("\n") { Some(idx) => match doc[idx..].find('\n') {
None => return error("test not found"), None => return error("test not found"),
Some(newline) => { Some(newline) => {
kind = Some(&doc[idx + 8..idx + newline]); kind = Some(&doc[idx + 8..idx + newline]);
@ -69,7 +69,7 @@ fn generate_test(fn_name: &str, doc: &str) -> String {
}; };
let mut tests = String::new(); let mut tests = String::new();
for (i, line) in doc.split("\n").enumerate() { for (i, line) in doc.split('\n').enumerate() {
let line = line.trim(); let line = line.trim();
if line.is_empty() { if line.is_empty() {
continue; continue;