Apply some clippy suggestions

This commit is contained in:
Graham Esau 2021-03-19 23:20:16 +00:00
parent b8c548136a
commit 3a7d7ad905
7 changed files with 15 additions and 22 deletions

View file

@ -52,7 +52,7 @@ fn get_doc(attrs: &[Attribute]) -> Option<String> {
.iter()
.flat_map(|a| a.split('\n'))
.map(str::trim)
.skip_while(|s| *s == "")
.skip_while(|s| s.is_empty())
.collect::<Vec<_>>();
if let Some(&"") = lines.last() {
@ -61,7 +61,7 @@ fn get_doc(attrs: &[Attribute]) -> Option<String> {
// Added for backward-compatibility, but perhaps we shouldn't do this
// https://github.com/rust-lang/rust/issues/32088
if lines.iter().all(|l| l.starts_with("*")) {
if lines.iter().all(|l| l.starts_with('*')) {
for line in lines.iter_mut() {
*line = line[1..].trim()
}

View file

@ -105,7 +105,7 @@ impl<'a> SchemaMetadata<'a> {
}
}
fn none_if_empty<'a>(s: &'a String) -> Option<&'a str> {
fn none_if_empty(s: &String) -> Option<&str> {
if s.is_empty() {
None
} else {

View file

@ -98,7 +98,7 @@ fn expr_for_external_tagged_enum<'a>(
}
let mut schemas = Vec::new();
if unit_variants.len() > 0 {
if !unit_variants.is_empty() {
schemas.push(unit_schema);
}