Update macro and cargo fmt

This commit is contained in:
Steve Cook
2023-03-01 13:43:21 -05:00
parent 51fcc98b34
commit b561bd77c3
19 changed files with 101 additions and 64 deletions

View File

@@ -70,7 +70,7 @@ fn impl_one_d_reader_macro(ast: &syn::DeriveInput) -> TokenStream {
Ok(result)
} else {
return Err(Exceptions::NotFoundException(None))
return Err(Exceptions::NOT_FOUND)
}
}
}
@@ -143,23 +143,23 @@ fn impl_one_d_writer_macro(ast: &syn::DeriveInput) -> TokenStream {
hints: &crate::EncodingHintDictionary,
) -> Result<crate::common::BitMatrix, crate::Exceptions> {
if contents.is_empty() {
return Err(Exceptions::IllegalArgumentException(
Some("Found empty contents".to_owned()),
return Err(Exceptions::illegal_argument_with(
"Found empty contents"
));
}
if width < 0 || height < 0 {
return Err(Exceptions::IllegalArgumentException(Some(format!(
return Err(Exceptions::illegal_argument_with(format!(
"Negative size is not allowed. Input: {}x{}",
width, height
))));
)));
}
if let Some(supportedFormats) = self.getSupportedWriteFormats() {
if !supportedFormats.contains(format) {
return Err(Exceptions::IllegalArgumentException(Some(format!(
return Err(Exceptions::illegal_argument_with(format!(
"Can only encode {:?}, but got {:?}",
supportedFormats, format
))));
)));
}
}