From 53da878bf347bf531740a9457d4ceec0dfd2cc22 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Mon, 2 May 2022 08:09:40 +0100 Subject: [PATCH] [TEM #1] - Remove dependency on aha-corasick --- Cargo.toml | 3 +-- src/links.rs | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 36f324b..48fa6fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,5 +27,4 @@ anyhow = "1.0.57" env_logger = "0.9.0" log = "0.4.16" lazy_static = "1.4.0" -fancy-regex = "0.10.0" -aho-corasick = "0.7.18" \ No newline at end of file +fancy-regex = "0.10.0" \ No newline at end of file diff --git a/src/links.rs b/src/links.rs index a0f9346..632482a 100644 --- a/src/links.rs +++ b/src/links.rs @@ -2,9 +2,8 @@ use std::collections::{HashMap, VecDeque}; use std::fs; use std::path::{Path, PathBuf}; -use aho_corasick::AhoCorasick; -use anyhow::{Context, Error}; -use fancy_regex::{CaptureMatches, Captures, Match, Regex}; +use anyhow::Context; +use fancy_regex::{CaptureMatches, Captures, Regex}; use lazy_static::lazy_static; use mdbook::errors::Result; @@ -195,7 +194,7 @@ impl<'a> Iterator for TemplateArgsIter<'a> { type Item = (&'a str, &'a str); fn next(&mut self) -> Option { - for cap in &mut self.0 { + if let Some(cap) = (&mut self.0).next() { let mut split_args = cap.unwrap().get(0).unwrap().as_str().splitn(2, '='); let key = split_args.next().unwrap().trim(); let value = split_args.next().unwrap();