fix clippy lints

This commit is contained in:
Damien Elmes 2020-11-24 20:13:05 +10:00
parent b55fd93cab
commit 3923f56cbf
3 changed files with 4 additions and 6 deletions

View file

@ -330,7 +330,7 @@ impl Collection {
Ok(self.storage.get_note(nid)?.unwrap())
}
// other errors are unhandled
_ => return Err(err),
_ => Err(err),
},
}
}

View file

@ -133,9 +133,7 @@ impl SqlWriter<'_> {
SearchNode::EditedInDays(days) => self.write_edited(*days)?,
SearchNode::CardTemplate(template) => match template {
TemplateKind::Ordinal(_) => self.write_template(template)?,
TemplateKind::Name(name) => {
self.write_template(&TemplateKind::Name(norm(name).into()))?
}
TemplateKind::Name(name) => self.write_template(&TemplateKind::Name(norm(name)))?,
},
SearchNode::Deck(deck) => self.write_deck(&norm(deck))?,
SearchNode::NoteTypeID(ntid) => {
@ -191,7 +189,7 @@ impl SqlWriter<'_> {
}
fn write_tag(&mut self, text: &str) -> Result<()> {
if text.contains(" ") {
if text.contains(' ') {
write!(self.sql, "false").unwrap();
} else {
match text {

View file

@ -298,7 +298,7 @@ pub(crate) fn to_custom_re<'a>(txt: &'a str, wildcard: &str) -> Cow<'a, str> {
}
/// Convert to SQL respecting Anki wildcards.
pub(crate) fn to_sql<'a>(txt: &'a str) -> Cow<'a, str> {
pub(crate) fn to_sql(txt: &str) -> Cow<str> {
// escape sequences and unescaped special characters which need conversion
lazy_static! {
static ref RE: Regex = Regex::new(r"\\[\\*]|[*%]").unwrap();