Skip to content

Commit

Permalink
Cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
archer884 committed Aug 18, 2018
1 parent bf97fb0 commit 1a91261
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
9 changes: 3 additions & 6 deletions src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ impl App {
.base_image
.get()
.map_err(|e| Error::not_found("Base image not found", e))
.and_then(|buf| {
Canvas::read_from_buffer(&buf).map_err(Error::bad_image)
})?;
.and_then(|buf| Canvas::read_from_buffer(&buf).map_err(Error::bad_image))?;

for annotation in &options.annotations {
canvas.add_annotation(annotation, &font, options.scale_mult);
Expand All @@ -35,9 +33,8 @@ fn build_font(path: &Path) -> Result<Typeface> {
let data = File::open(path)
.map(BufReader::new)
.map_err(|e| Error::not_found("Font not found", e))?;

artano::load_typeface(data)
.map_err(|e| Error::io("Unable to read font", e))

artano::load_typeface(data).map_err(|e| Error::io("Unable to read font", e))
}

fn save_pixels<P: AsRef<Path>>(path: P, canvas: &Canvas, format: OutputFormat) -> Result<()> {
Expand Down
18 changes: 9 additions & 9 deletions src/config/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ impl OptionsBuilder {
}

let output_format = self.output_format;
let output_path = self.output_path.map(|s| s.into()).unwrap_or_else(|| {
create_output_file_path(&input_path, output_format)
});
let output_path = self
.output_path
.map(|s| s.into())
.unwrap_or_else(|| create_output_file_path(&input_path, output_format));

let annotations = if self.annotations.is_empty() {
return Err(BuildOptionsError {
Expand Down Expand Up @@ -138,8 +139,7 @@ fn read_command() -> Result<Options> {

let encoding_group = ArgGroup::with_name("enc_group").args(&["jpg", "png"]);

let app =
clap_app!(annatar =>
let app = clap_app!(annatar =>
(version: crate_version!())
(author: crate_authors!())
(about: crate_description!())
Expand Down Expand Up @@ -167,13 +167,13 @@ fn read_command() -> Result<Options> {
options.output_path = matches.value_of("output").map(|s| s.to_string());

if let Some(scale_multiplier) = matches.value_of("scale") {
let multiplier = scale_multiplier.parse::<f32>().map_err(|e| {
BuildOptionsError {
let multiplier = scale_multiplier
.parse::<f32>()
.map_err(|e| BuildOptionsError {
kind: BuildOptionsErrorKind::ScalingMultiplier,
description: Cow::from("Scaling multiplier must be a decimal value"),
cause: Some(Box::new(e)),
}
})?;
})?;
options.scale_mult = multiplier;
}

Expand Down

0 comments on commit 1a91261

Please sign in to comment.