Skip to content

Commit

Permalink
Fix rustc 1.37 build
Browse files Browse the repository at this point in the history
  • Loading branch information
GREsau committed Mar 27, 2021
1 parent 29dc025 commit dada858
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions schemars_derive/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ impl ToTokens for SchemaMetadata<'_> {
impl<'a> SchemaMetadata<'a> {
pub fn from_attrs(attrs: &'a Attrs) -> Self {
SchemaMetadata {
title: attrs.title.as_deref().and_then(none_if_empty),
description: attrs.description.as_deref().and_then(none_if_empty),
title: attrs.title.as_ref().and_then(none_if_empty),
description: attrs.description.as_ref().and_then(none_if_empty),
deprecated: attrs.deprecated,
examples: &attrs.examples,
read_only: false,
Expand Down Expand Up @@ -106,7 +106,8 @@ impl<'a> SchemaMetadata<'a> {
}
}

fn none_if_empty(s: &str) -> Option<&str> {
#[allow(clippy::ptr_arg)]
fn none_if_empty(s: &String) -> Option<&str> {
if s.is_empty() {
None
} else {
Expand Down

0 comments on commit dada858

Please sign in to comment.