From 104968f95e4f3f8f042a11506944cc3af12af7d4 Mon Sep 17 00:00:00 2001 From: Artemy Egorov Date: Sun, 4 Aug 2024 11:10:43 +0300 Subject: [PATCH] fix: pass &str instead of String in parse_gemtext --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/parsers/gemtext.rs | 4 ++-- tests/bench.rs | 5 +---- tests/gemtext.rs | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f190fc5..91bf87a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,7 +151,7 @@ dependencies = [ [[package]] name = "dalet" -version = "1.0.0-pre6" +version = "1.0.0-pre7" dependencies = [ "bincode", "clap", diff --git a/Cargo.toml b/Cargo.toml index 327453a..23ab30f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dalet" -version = "1.0.0-pre6" +version = "1.0.0-pre7" edition = "2021" authors = ["artegoser"] license = "MIT" diff --git a/src/parsers/gemtext.rs b/src/parsers/gemtext.rs index cab8931..7829bbe 100644 --- a/src/parsers/gemtext.rs +++ b/src/parsers/gemtext.rs @@ -1,5 +1,5 @@ use crate::typed::{ - Body, Hl, NNBody, + Body, Hl, Tag::{self, *}, }; @@ -8,7 +8,7 @@ pub enum GemTextParseError { InvalidLink, } -pub fn parse_gemtext(s: String) -> Result, GemTextParseError> { +pub fn parse_gemtext(s: &str) -> Result, GemTextParseError> { let mut page: Vec = Vec::new(); let mut preformatted = false; let mut preformatted_text: Vec = Vec::new(); diff --git a/tests/bench.rs b/tests/bench.rs index 17908f3..c25a9f4 100644 --- a/tests/bench.rs +++ b/tests/bench.rs @@ -1,10 +1,7 @@ use dalet::{ daletl::ToDaletlPage, daletpack::*, - typed::{ - Body, Hl, NNBody, Page, TNArg, - Tag::{self, *}, - }, + typed::{Hl, Page, TNArg, Tag::*}, }; use flate2::Compression; use std::io::Write; diff --git a/tests/gemtext.rs b/tests/gemtext.rs index 27edf8b..ffb2bfe 100644 --- a/tests/gemtext.rs +++ b/tests/gemtext.rs @@ -4,7 +4,7 @@ use dalet::parsers::gemtext::parse_gemtext; fn gem_text() { let text = include_str!("./gemtext.gmi"); - let parsed = parse_gemtext(text.to_owned()).unwrap(); + let parsed = parse_gemtext(&text).unwrap(); println!("{:#?}", parsed); }