Skip to content

Commit 75f670a

Browse files
authored
Improve json_schema!-macro compability with older rust editions (#447)
`TryFrom` is only available in the prelude for Rust 2021+
1 parent 2697ecb commit 75f670a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

schemars/src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ macro_rules! json_schema {
102102
(
103103
{$($json_object:tt)*}
104104
) => {
105-
$crate::Schema::try_from($crate::_private::serde_json::json!({$($json_object)*})).unwrap()
105+
<$crate::Schema as ::core::convert::TryFrom<_>>::try_from($crate::_private::serde_json::json!({$($json_object)*})).unwrap()
106106
};
107107
(true) => {
108108
$crate::Schema::from(true)

0 commit comments

Comments
 (0)