Skip to content

Commit

Permalink
Merge pull request #21 from Screwtapello/fix-for-rust-1.24
Browse files Browse the repository at this point in the history
Ask for an OsStr when converting between MdPath and RsPath.
  • Loading branch information
pnkfelix authored Apr 27, 2018
2 parents 24f7c64 + 6fc114a commit 2f1a768
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use walkdir::{WalkDir};
use std::convert;
use std::env;
use std::error::Error as ErrorTrait;
use std::ffi::OsStr;
use std::fmt;
use std::fs::{self, File};
use std::io::{self, Read, Write};
Expand Down Expand Up @@ -369,7 +370,10 @@ impl RsPath {
fn to_md(&self) -> MdPath {
let mut p = PathBuf::new();
p.push(get_lit_dir());
for c in self.0.components().skip(1) { p.push(c.as_ref().to_str().expect("how else can I replace root?")); }
for c in self.0.components().skip(1) {
let c: &OsStr = c.as_ref();
p.push(c.to_str().expect("how else can I replace root?"));
}
p.set_extension("md");
MdPath::new(p)
}
Expand All @@ -383,7 +387,10 @@ impl MdPath {
fn to_rs(&self) -> RsPath {
let mut p = PathBuf::new();
p.push(get_src_dir());
for c in self.0.components().skip(1) { p.push(c.as_ref().to_str().expect("how else can I replace root?")); }
for c in self.0.components().skip(1) {
let c: &OsStr = c.as_ref();
p.push(c.to_str().expect("how else can I replace root?"));
}
p.set_extension("rs");
RsPath::new(p)
}
Expand Down

0 comments on commit 2f1a768

Please sign in to comment.