Format code using 'cargo fmt'
This commit is contained in:
parent
65ae47fbf8
commit
f286c631b9
3 changed files with 13 additions and 11 deletions
3
build.rs
3
build.rs
|
@ -152,7 +152,8 @@ fn find_image_magick_include_dirs() -> Vec<PathBuf> {
|
||||||
.or_else(|_| Ok(vec![find_image_magick_dir()?.join("include")]))
|
.or_else(|_| Ok(vec![find_image_magick_dir()?.join("include")]))
|
||||||
.or_else(|_: env::VarError| -> Result<_, env::VarError> {
|
.or_else(|_: env::VarError| -> Result<_, env::VarError> {
|
||||||
Ok(run_pkg_config().include_paths)
|
Ok(run_pkg_config().include_paths)
|
||||||
}).expect("Couldn't find ImageMagick include directory")
|
})
|
||||||
|
.expect("Couldn't find ImageMagick include directory")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_image_magick_dir() -> Result<PathBuf, env::VarError> {
|
fn find_image_magick_dir() -> Result<PathBuf, env::VarError> {
|
||||||
|
|
|
@ -44,7 +44,9 @@ macro_rules! wand_common {
|
||||||
unsafe { ::bindings::$get_exc_type(self.wand) }
|
unsafe { ::bindings::$get_exc_type(self.wand) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_exception(&self) -> Result<(String, ::bindings::ExceptionType), &'static str> {
|
pub fn get_exception(
|
||||||
|
&self,
|
||||||
|
) -> Result<(String, ::bindings::ExceptionType), &'static str> {
|
||||||
let mut severity: ::bindings::ExceptionType =
|
let mut severity: ::bindings::ExceptionType =
|
||||||
::bindings::ExceptionType_UndefinedException;
|
::bindings::ExceptionType_UndefinedException;
|
||||||
// TODO: memory management
|
// TODO: memory management
|
||||||
|
|
15
tests/lib.rs
15
tests/lib.rs
|
@ -234,10 +234,9 @@ fn test_transform_image_colorspace() {
|
||||||
let pixel_color = wand.get_image_pixel_color(10, 10).unwrap();
|
let pixel_color = wand.get_image_pixel_color(10, 10).unwrap();
|
||||||
assert_ne!(pixel_color.get_hsl().hue, 0.0);
|
assert_ne!(pixel_color.get_hsl().hue, 0.0);
|
||||||
|
|
||||||
assert!(
|
assert!(wand
|
||||||
wand.transform_image_colorspace(bindings::ColorspaceType_GRAYColorspace)
|
.transform_image_colorspace(bindings::ColorspaceType_GRAYColorspace)
|
||||||
.is_ok()
|
.is_ok());
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
wand.get_image_colorspace(),
|
wand.get_image_colorspace(),
|
||||||
bindings::ColorspaceType_GRAYColorspace
|
bindings::ColorspaceType_GRAYColorspace
|
||||||
|
@ -266,15 +265,15 @@ fn test_color_reduction() {
|
||||||
let image_colors = wand.get_image_colors();
|
let image_colors = wand.get_image_colors();
|
||||||
assert!(image_colors > 38000 || image_colors < 40000);
|
assert!(image_colors > 38000 || image_colors < 40000);
|
||||||
|
|
||||||
assert!(
|
assert!(wand
|
||||||
wand.quantize_image(
|
.quantize_image(
|
||||||
6,
|
6,
|
||||||
bindings::ColorspaceType_RGBColorspace,
|
bindings::ColorspaceType_RGBColorspace,
|
||||||
1,
|
1,
|
||||||
bindings::DitherMethod_UndefinedDitherMethod,
|
bindings::DitherMethod_UndefinedDitherMethod,
|
||||||
false.to_magick()
|
false.to_magick()
|
||||||
).is_ok()
|
)
|
||||||
);
|
.is_ok());
|
||||||
assert_eq!(6, wand.get_image_colors());
|
assert_eq!(6, wand.get_image_colors());
|
||||||
|
|
||||||
let histogram = wand.get_image_histogram().unwrap();
|
let histogram = wand.get_image_histogram().unwrap();
|
||||||
|
|
Loading…
Reference in a new issue