Skip to content

Commit

Permalink
Use more generic way to get a Path
Browse files Browse the repository at this point in the history
  • Loading branch information
killercup committed Apr 17, 2018
1 parent dc05d33 commit 80046e1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use report::{Method, Report};

use failure::Error as FailError;
use std::io::{Result as IoResult, Write};
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::panic::PanicInfo;
use termcolor::{BufferWriter, Color, ColorChoice, ColorSpec, WriteColor};

Expand Down Expand Up @@ -51,7 +51,10 @@ macro_rules! setup_panic {
}

/// Utility function that prints a message to our human users
pub fn print_msg(file_path: PathBuf, meta: &Metadata) -> IoResult<()> {
pub fn print_msg<P: AsRef<Path>>(
file_path: P,
meta: &Metadata,
) -> IoResult<()> {
let (_version, name, authors, homepage) =
(meta.version, meta.name, meta.authors, meta.homepage);

Expand All @@ -71,7 +74,7 @@ pub fn print_msg(file_path: PathBuf, meta: &Metadata) -> IoResult<()> {
"We have generated a report file at \"{}\". Submit an \
issue or email with the subject of \"{} Crash Report\" and include the \
report as an attachment.\n",
file_path.display(),
file_path.as_ref().display(),
name
)?;

Expand Down

0 comments on commit 80046e1

Please sign in to comment.