Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
naiquevin committed Jun 19, 2024
1 parent fe5a267 commit 223d3f5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tagging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl NameTagger {
let style = t
.get("style")
.ok_or(parse_error!("Key 'name_tagger.style' is missing"))
.map(|s| NameTagStyle::decode(s))??;
.map(NameTagStyle::decode)??;
Ok(Some(Self { style }))
}
None => Ok(None),
Expand All @@ -86,15 +86,15 @@ impl NameTagger {
// Note that this function also trims any leading blank lines
pub fn ensure_name_tag<'a>(&self, sql: &'a str, name_tag: &'a NameTag) -> Cow<'a, str> {
let sql = sql.trim_start();
if has_name_tag(&sql) {
if has_name_tag(sql) {
Cow::from(sql)
} else {
let tag = match name_tag {
NameTag::DeriveFromId(id) => self.style.make_tag(id),
NameTag::Custom(s) => Cow::from(s),
};
let mut result = format!("-- name: {tag}");
result.push_str("\n");
result.push('\n');
result.push_str(sql);
Cow::from(result)
}
Expand Down

0 comments on commit 223d3f5

Please sign in to comment.