perf: Reduce the number of generated LLVM lines
This commit is contained in:
parent
347e01541b
commit
aa04159dee
|
@ -7,6 +7,7 @@
|
|||
- Optimize the loop implementation used for uniqueness check on short arrays.
|
||||
- Simplify `equal_arrays` helper.
|
||||
- Shortcut for `false` schemas.
|
||||
- Reduce the number of generated LLVM lines.
|
||||
|
||||
## [0.13.3] - 2021-12-08
|
||||
|
||||
|
|
|
@ -770,13 +770,13 @@ impl fmt::Display for ValidationError<'_> {
|
|||
#[inline]
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match &self.kind {
|
||||
ValidationErrorKind::Schema => write!(f, "Schema error"),
|
||||
ValidationErrorKind::JSONParse { error } => write!(f, "{}", error),
|
||||
ValidationErrorKind::Schema => f.write_str("Schema error"),
|
||||
ValidationErrorKind::JSONParse { error } => error.fmt(f),
|
||||
#[cfg(any(feature = "reqwest", test))]
|
||||
ValidationErrorKind::Reqwest { error } => write!(f, "{}", error),
|
||||
ValidationErrorKind::FileNotFound { error } => write!(f, "{}", error),
|
||||
ValidationErrorKind::InvalidURL { error } => write!(f, "{}", error),
|
||||
ValidationErrorKind::BacktrackLimitExceeded { error } => write!(f, "{}", error),
|
||||
ValidationErrorKind::Reqwest { error } => error.fmt(f),
|
||||
ValidationErrorKind::FileNotFound { error } => error.fmt(f),
|
||||
ValidationErrorKind::InvalidURL { error } => error.fmt(f),
|
||||
ValidationErrorKind::BacktrackLimitExceeded { error } => error.fmt(f),
|
||||
ValidationErrorKind::UnknownReferenceScheme { scheme } => {
|
||||
write!(f, "Unknown scheme: {}", scheme)
|
||||
}
|
||||
|
@ -857,8 +857,8 @@ impl fmt::Display for ValidationError<'_> {
|
|||
self.instance, content_media_type
|
||||
)
|
||||
}
|
||||
ValidationErrorKind::FromUtf8 { error } => write!(f, "{}", error),
|
||||
ValidationErrorKind::Utf8 { error } => write!(f, "{}", error),
|
||||
ValidationErrorKind::FromUtf8 { error } => error.fmt(f),
|
||||
ValidationErrorKind::Utf8 { error } => error.fmt(f),
|
||||
ValidationErrorKind::Enum { options } => {
|
||||
write!(f, "{} is not one of {}", self.instance, options)
|
||||
}
|
||||
|
@ -939,9 +939,7 @@ impl fmt::Display for ValidationError<'_> {
|
|||
ValidationErrorKind::Pattern { pattern } => {
|
||||
write!(f, r#"{} does not match "{}""#, self.instance, pattern)
|
||||
}
|
||||
ValidationErrorKind::PropertyNames { error } => {
|
||||
write!(f, "{}", error.to_string())
|
||||
}
|
||||
ValidationErrorKind::PropertyNames { error } => error.fmt(f),
|
||||
ValidationErrorKind::Required { property } => {
|
||||
write!(f, "{} is a required property", property)
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ pub fn main() -> BoxErrorResult<()> {
|
|||
let config = Cli::from_args();
|
||||
|
||||
if config.version {
|
||||
println!("Version: {}", env!("CARGO_PKG_VERSION"));
|
||||
println!(concat!("Version: ", env!("CARGO_PKG_VERSION")));
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@ pub struct ErrorDescription(String);
|
|||
|
||||
impl fmt::Display for ErrorDescription {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", self.0)
|
||||
f.write_str(&self.0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,13 +20,13 @@ pub enum PrimitiveType {
|
|||
impl fmt::Display for PrimitiveType {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
PrimitiveType::Array => write!(f, "array"),
|
||||
PrimitiveType::Boolean => write!(f, "boolean"),
|
||||
PrimitiveType::Integer => write!(f, "integer"),
|
||||
PrimitiveType::Null => write!(f, "null"),
|
||||
PrimitiveType::Number => write!(f, "number"),
|
||||
PrimitiveType::Object => write!(f, "object"),
|
||||
PrimitiveType::String => write!(f, "string"),
|
||||
PrimitiveType::Array => f.write_str("array"),
|
||||
PrimitiveType::Boolean => f.write_str("boolean"),
|
||||
PrimitiveType::Integer => f.write_str("integer"),
|
||||
PrimitiveType::Null => f.write_str("null"),
|
||||
PrimitiveType::Number => f.write_str("number"),
|
||||
PrimitiveType::Object => f.write_str("object"),
|
||||
PrimitiveType::String => f.write_str("string"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ impl SchemaNode {
|
|||
}
|
||||
|
||||
fn format_validators(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", format_validators(self.validators()))
|
||||
f.write_str(&format_validators(self.validators()))
|
||||
}
|
||||
|
||||
/// This is similar to `Validate::apply` except that `SchemaNode` knows where it is in the
|
||||
|
|
Loading…
Reference in New Issue