Skip to content

Rename to_url → into_url #7048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/resolver-tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ use cargo::core::resolver::{self, Method};
use cargo::core::source::{GitReference, SourceId};
use cargo::core::Resolve;
use cargo::core::{Dependency, PackageId, Registry, Summary};
use cargo::util::{CargoResult, Config, Graph, ToUrl};
use cargo::util::{CargoResult, Config, Graph, IntoUrl};

use proptest::collection::{btree_map, vec};
use proptest::prelude::*;
@@ -504,7 +504,7 @@ macro_rules! pkg {
fn registry_loc() -> SourceId {
lazy_static::lazy_static! {
static ref EXAMPLE_DOT_COM: SourceId =
SourceId::for_registry(&"https://example.com".to_url().unwrap()).unwrap();
SourceId::for_registry(&"https://example.com".into_url().unwrap()).unwrap();
}
*EXAMPLE_DOT_COM
}
@@ -535,7 +535,7 @@ pub fn pkg_id(name: &str) -> PackageId {
}

fn pkg_id_loc(name: &str, loc: &str) -> PackageId {
let remote = loc.to_url();
let remote = loc.into_url();
let master = GitReference::Branch("master".to_string());
let source_id = SourceId::for_git(&remote.unwrap(), master).unwrap();

@@ -586,7 +586,7 @@ pub fn dep_req_kind(name: &str, req: &str, kind: Kind, public: bool) -> Dependen
}

pub fn dep_loc(name: &str, location: &str) -> Dependency {
let url = location.to_url().unwrap();
let url = location.into_url().unwrap();
let master = GitReference::Branch("master".to_string());
let source_id = SourceId::for_git(&url, master).unwrap();
Dependency::parse_no_deprecated(name, Some("1.0.0"), source_id).unwrap()
4 changes: 2 additions & 2 deletions src/bin/cargo/commands/git_checkout.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ use crate::command_prelude::*;

use cargo::core::{GitReference, Source, SourceId};
use cargo::sources::GitSource;
use cargo::util::ToUrl;
use cargo::util::IntoUrl;

pub fn cli() -> App {
subcommand("git-checkout")
@@ -23,7 +23,7 @@ pub fn cli() -> App {
}

pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
let url = args.value_of("url").unwrap().to_url()?;
let url = args.value_of("url").unwrap().into_url()?;
let reference = args.value_of("reference").unwrap();

let reference = GitReference::Branch(reference.to_string());
4 changes: 2 additions & 2 deletions src/bin/cargo/commands/install.rs
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ use crate::command_prelude::*;

use cargo::core::{GitReference, SourceId};
use cargo::ops;
use cargo::util::ToUrl;
use cargo::util::IntoUrl;

pub fn cli() -> App {
subcommand("install")
@@ -127,7 +127,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
let mut from_cwd = false;

let source = if let Some(url) = args.value_of("git") {
let url = url.to_url()?;
let url = url.into_url()?;
let gitref = if let Some(branch) = args.value_of("branch") {
GitReference::Branch(branch.to_string())
} else if let Some(tag) = args.value_of("tag") {
10 changes: 5 additions & 5 deletions src/cargo/core/package_id.rs
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ impl ser::Serialize for PackageId {
"{} {} ({})",
self.inner.name,
self.inner.version,
self.inner.source_id.to_url()
self.inner.source_id.into_url()
))
}
}
@@ -205,11 +205,11 @@ mod tests {
use super::PackageId;
use crate::core::source::SourceId;
use crate::sources::CRATES_IO_INDEX;
use crate::util::ToUrl;
use crate::util::IntoUrl;

#[test]
fn invalid_version_handled_nicely() {
let loc = CRATES_IO_INDEX.to_url().unwrap();
let loc = CRATES_IO_INDEX.into_url().unwrap();
let repo = SourceId::for_registry(&loc).unwrap();

assert!(PackageId::new("foo", "1.0", repo).is_err());
@@ -220,7 +220,7 @@ mod tests {

#[test]
fn debug() {
let loc = CRATES_IO_INDEX.to_url().unwrap();
let loc = CRATES_IO_INDEX.into_url().unwrap();
let pkg_id = PackageId::new("foo", "1.0.0", SourceId::for_registry(&loc).unwrap()).unwrap();
assert_eq!(r#"PackageId { name: "foo", version: "1.0.0", source: "registry `https://github.com/rust-lang/crates.io-index`" }"#, format!("{:?}", pkg_id));

@@ -254,7 +254,7 @@ PackageId {

#[test]
fn display() {
let loc = CRATES_IO_INDEX.to_url().unwrap();
let loc = CRATES_IO_INDEX.into_url().unwrap();
let pkg_id = PackageId::new("foo", "1.0.0", SourceId::for_registry(&loc).unwrap()).unwrap();
assert_eq!("foo v1.0.0", pkg_id.to_string());
}
4 changes: 2 additions & 2 deletions src/cargo/core/package_id_spec.rs
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ use url::Url;
use crate::core::interning::InternedString;
use crate::core::PackageId;
use crate::util::errors::{CargoResult, CargoResultExt};
use crate::util::{validate_package_name, ToSemver, ToUrl};
use crate::util::{validate_package_name, IntoUrl, ToSemver};

/// Some or all of the data required to identify a package:
///
@@ -50,7 +50,7 @@ impl PackageIdSpec {
/// }
pub fn parse(spec: &str) -> CargoResult<PackageIdSpec> {
if spec.contains('/') {
if let Ok(url) = spec.to_url() {
if let Ok(url) = spec.into_url() {
return PackageIdSpec::from_url(url);
}
if !spec.contains("://") {
2 changes: 1 addition & 1 deletion src/cargo/core/resolver/encode.rs
Original file line number Diff line number Diff line change
@@ -269,7 +269,7 @@ impl fmt::Display for EncodablePackageId {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{} {}", self.name, self.version)?;
if let Some(ref s) = self.source {
write!(f, " ({})", s.to_url())?;
write!(f, " ({})", s.into_url())?;
}
Ok(())
}
32 changes: 16 additions & 16 deletions src/cargo/core/source/source_id.rs
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ use crate::ops;
use crate::sources::git;
use crate::sources::DirectorySource;
use crate::sources::{GitSource, PathSource, RegistrySource, CRATES_IO_INDEX};
use crate::util::{CargoResult, Config, ToUrl};
use crate::util::{CargoResult, Config, IntoUrl};

lazy_static::lazy_static! {
static ref SOURCE_ID_CACHE: Mutex<HashSet<&'static SourceIdInner>> = Mutex::new(HashSet::new());
@@ -117,7 +117,7 @@ impl SourceId {

match kind {
"git" => {
let mut url = url.to_url()?;
let mut url = url.into_url()?;
let mut reference = GitReference::Branch("master".to_string());
for (k, v) in url.query_pairs() {
match &k[..] {
@@ -135,11 +135,11 @@ impl SourceId {
Ok(SourceId::for_git(&url, reference)?.with_precise(precise))
}
"registry" => {
let url = url.to_url()?;
let url = url.into_url()?;
Ok(SourceId::new(Kind::Registry, url)?.with_precise(Some("locked".to_string())))
}
"path" => {
let url = url.to_url()?;
let url = url.into_url()?;
SourceId::new(Kind::Path, url)
}
kind => Err(failure::format_err!(
@@ -150,8 +150,8 @@ impl SourceId {
}

/// A view of the `SourceId` that can be `Display`ed as a URL.
pub fn to_url(&self) -> SourceIdToUrl<'_> {
SourceIdToUrl {
pub fn into_url(&self) -> SourceIdIntoUrl<'_> {
SourceIdIntoUrl {
inner: &*self.inner,
}
}
@@ -160,7 +160,7 @@ impl SourceId {
///
/// `path`: an absolute path.
pub fn for_path(path: &Path) -> CargoResult<SourceId> {
let url = path.to_url()?;
let url = path.into_url()?;
SourceId::new(Kind::Path, url)
}

@@ -176,13 +176,13 @@ impl SourceId {

/// Creates a SourceId from a local registry path.
pub fn for_local_registry(path: &Path) -> CargoResult<SourceId> {
let url = path.to_url()?;
let url = path.into_url()?;
SourceId::new(Kind::LocalRegistry, url)
}

/// Creates a `SourceId` from a directory path.
pub fn for_directory(path: &Path) -> CargoResult<SourceId> {
let url = path.to_url()?;
let url = path.into_url()?;
SourceId::new(Kind::Directory, url)
}

@@ -207,7 +207,7 @@ impl SourceId {
} else {
CRATES_IO_INDEX
};
let url = url.to_url()?;
let url = url.into_url()?;
SourceId::for_registry(&url)
})
}
@@ -390,7 +390,7 @@ impl ser::Serialize for SourceId {
if self.is_path() {
None::<String>.serialize(s)
} else {
s.collect_str(&self.to_url())
s.collect_str(&self.into_url())
}
}
}
@@ -504,11 +504,11 @@ impl Hash for SourceId {
}

/// A `Display`able view into a `SourceId` that will write it as a url
pub struct SourceIdToUrl<'a> {
pub struct SourceIdIntoUrl<'a> {
inner: &'a SourceIdInner,
}

impl<'a> fmt::Display for SourceIdToUrl<'a> {
impl<'a> fmt::Display for SourceIdIntoUrl<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self.inner {
SourceIdInner {
@@ -579,15 +579,15 @@ impl<'a> fmt::Display for PrettyRef<'a> {
#[cfg(test)]
mod tests {
use super::{GitReference, Kind, SourceId};
use crate::util::ToUrl;
use crate::util::IntoUrl;

#[test]
fn github_sources_equal() {
let loc = "https://github.com/foo/bar".to_url().unwrap();
let loc = "https://github.com/foo/bar".into_url().unwrap();
let master = Kind::Git(GitReference::Branch("master".to_string()));
let s1 = SourceId::new(master.clone(), loc).unwrap();

let loc = "git://github.com/foo/bar".to_url().unwrap();
let loc = "git://github.com/foo/bar".into_url().unwrap();
let s2 = SourceId::new(master, loc.clone()).unwrap();

assert_eq!(s1, s2);
4 changes: 2 additions & 2 deletions src/cargo/ops/registry.rs
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ use crate::sources::{RegistrySource, SourceConfigMap, CRATES_IO_REGISTRY};
use crate::util::config::{self, Config};
use crate::util::errors::{CargoResult, CargoResultExt};
use crate::util::important_paths::find_root_manifest_for_wd;
use crate::util::ToUrl;
use crate::util::IntoUrl;
use crate::util::{paths, validate_package_name};
use crate::version;

@@ -696,7 +696,7 @@ fn get_source_id(
) -> CargoResult<SourceId> {
match (reg, index) {
(Some(r), _) => SourceId::alt_registry(config, &r),
(_, Some(i)) => SourceId::for_registry(&i.to_url()?),
(_, Some(i)) => SourceId::for_registry(&i.into_url()?),
_ => {
let map = SourceConfigMap::new(config)?;
let src = map.load(SourceId::crates_io(config)?, &HashSet::new())?;
4 changes: 2 additions & 2 deletions src/cargo/sources/config.rs
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ use crate::core::{GitReference, PackageId, Source, SourceId};
use crate::sources::{ReplacedSource, CRATES_IO_REGISTRY};
use crate::util::config::ConfigValue;
use crate::util::errors::{CargoResult, CargoResultExt};
use crate::util::{Config, ToUrl};
use crate::util::{Config, IntoUrl};

#[derive(Clone)]
pub struct SourceConfigMap<'cfg> {
@@ -242,7 +242,7 @@ restore the source replacement configuration to continue the build

fn url(cfg: &ConfigValue, key: &str) -> CargoResult<Url> {
let (url, path) = cfg.string(key)?;
let url = url.to_url().chain_err(|| {
let url = url.into_url().chain_err(|| {
format!(
"configuration key `{}` specified an invalid \
URL (in {})",
4 changes: 2 additions & 2 deletions src/cargo/sources/git/source.rs
Original file line number Diff line number Diff line change
@@ -241,7 +241,7 @@ impl<'cfg> Source for GitSource<'cfg> {
#[cfg(test)]
mod test {
use super::ident;
use crate::util::ToUrl;
use crate::util::IntoUrl;
use url::Url;

#[test]
@@ -291,6 +291,6 @@ mod test {
}

fn url(s: &str) -> Url {
s.to_url().unwrap()
s.into_url().unwrap()
}
}
8 changes: 4 additions & 4 deletions src/cargo/sources/git/utils.rs
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ use crate::core::GitReference;
use crate::util::errors::{CargoResult, CargoResultExt};
use crate::util::paths;
use crate::util::process_builder::process;
use crate::util::{internal, network, Config, Progress, ToUrl};
use crate::util::{internal, network, Config, IntoUrl, Progress};

#[derive(PartialEq, Clone, Debug)]
pub struct GitRevision(git2::Oid);
@@ -274,7 +274,7 @@ impl<'a> GitCheckout<'a> {
//
// Note that we still use the same fetch options because while we don't
// need authentication information we may want progress bars and such.
let url = database.path.to_url()?;
let url = database.path.into_url()?;
let mut repo = None;
with_fetch_options(&git_config, &url, config, &mut |fopts| {
let mut checkout = git2::build::CheckoutBuilder::new();
@@ -310,7 +310,7 @@ impl<'a> GitCheckout<'a> {

fn fetch(&mut self, cargo_config: &Config) -> CargoResult<()> {
info!("fetch {}", self.repo.path().display());
let url = self.database.path.to_url()?;
let url = self.database.path.into_url()?;
let refspec = "refs/heads/*:refs/heads/*";
fetch(&mut self.repo, &url, refspec, cargo_config)?;
Ok(())
@@ -396,7 +396,7 @@ impl<'a> GitCheckout<'a> {

// Fetch data from origin and reset to the head commit
let refspec = "refs/heads/*:refs/heads/*";
let url = url.to_url()?;
let url = url.into_url()?;
fetch(&mut repo, &url, refspec, cargo_config).chain_err(|| {
internal(format!(
"failed to fetch submodule `{}` from {}",
4 changes: 2 additions & 2 deletions src/cargo/sources/registry/mod.rs
Original file line number Diff line number Diff line change
@@ -177,7 +177,7 @@ use crate::core::{InternedString, Package, PackageId, Source, SourceId, Summary}
use crate::sources::PathSource;
use crate::util::errors::CargoResultExt;
use crate::util::hex;
use crate::util::to_url::ToUrl;
use crate::util::into_url::IntoUrl;
use crate::util::{internal, CargoResult, Config, Filesystem};

const PACKAGE_SOURCE_LOCK: &str = ".cargo-ok";
@@ -304,7 +304,7 @@ impl<'a> RegistryDependency<'a> {
} = self;

let id = if let Some(registry) = &registry {
SourceId::for_registry(&registry.to_url()?)?
SourceId::for_registry(&registry.into_url()?)?
} else {
default
};
6 changes: 3 additions & 3 deletions src/cargo/util/config.rs
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ use crate::util::toml as cargo_toml;
use crate::util::Filesystem;
use crate::util::Rustc;
use crate::util::{paths, validate_package_name, FileLock};
use crate::util::{ToUrl, ToUrlWithBase};
use crate::util::{IntoUrl, IntoUrlWithBase};

/// Configuration information for cargo. This is not specific to a build, it is information
/// relating to cargo itself.
@@ -714,8 +714,8 @@ impl Config {
.root(self)
.join("truncated-by-url_with_base");
// Parse val to check it is a URL, not a relative path without a protocol.
let _parsed = index.val.to_url()?;
let url = index.val.to_url_with_base(Some(&*base))?;
let _parsed = index.val.into_url()?;
let url = index.val.into_url_with_base(Some(&*base))?;
if url.password().is_some() {
failure::bail!("Registry URLs may not contain passwords");
}
18 changes: 9 additions & 9 deletions src/cargo/util/to_url.rs → src/cargo/util/into_url.rs
Original file line number Diff line number Diff line change
@@ -5,26 +5,26 @@ use url::Url;
use crate::util::CargoResult;

/// A type that can be converted to a Url
pub trait ToUrl {
pub trait IntoUrl {
/// Performs the conversion
fn to_url(self) -> CargoResult<Url>;
fn into_url(self) -> CargoResult<Url>;
}

impl<'a> ToUrl for &'a str {
fn to_url(self) -> CargoResult<Url> {
impl<'a> IntoUrl for &'a str {
fn into_url(self) -> CargoResult<Url> {
Url::parse(self).map_err(|s| failure::format_err!("invalid url `{}`: {}", self, s))
}
}

impl<'a> ToUrl for &'a Path {
fn to_url(self) -> CargoResult<Url> {
impl<'a> IntoUrl for &'a Path {
fn into_url(self) -> CargoResult<Url> {
Url::from_file_path(self)
.map_err(|()| failure::format_err!("invalid path url `{}`", self.display()))
}
}

impl<'a> ToUrl for &'a PathBuf {
fn to_url(self) -> CargoResult<Url> {
self.as_path().to_url()
impl<'a> IntoUrl for &'a PathBuf {
fn into_url(self) -> CargoResult<Url> {
self.as_path().into_url()
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use crate::util::{CargoResult, ToUrl};
use crate::util::{CargoResult, IntoUrl};

use url::Url;

/// A type that can be interpreted as a relative Url and converted to
/// a Url.
pub trait ToUrlWithBase {
pub trait IntoUrlWithBase {
/// Performs the conversion
fn to_url_with_base<U: ToUrl>(self, base: Option<U>) -> CargoResult<Url>;
fn into_url_with_base<U: IntoUrl>(self, base: Option<U>) -> CargoResult<Url>;
}

impl<'a> ToUrlWithBase for &'a str {
fn to_url_with_base<U: ToUrl>(self, base: Option<U>) -> CargoResult<Url> {
impl<'a> IntoUrlWithBase for &'a str {
fn into_url_with_base<U: IntoUrl>(self, base: Option<U>) -> CargoResult<Url> {
let base_url = match base {
Some(base) => Some(
base.to_url()
base.into_url()
.map_err(|s| failure::format_err!("invalid url `{}`: {}", self, s))?,
),
None => None,
@@ -28,20 +28,20 @@ impl<'a> ToUrlWithBase for &'a str {

#[cfg(test)]
mod tests {
use crate::util::ToUrlWithBase;
use crate::util::IntoUrlWithBase;

#[test]
fn to_url_with_base() {
fn into_url_with_base() {
assert_eq!(
"rel/path"
.to_url_with_base(Some("file:///abs/path/"))
.into_url_with_base(Some("file:///abs/path/"))
.unwrap()
.to_string(),
"file:///abs/path/rel/path"
);
assert_eq!(
"rel/path"
.to_url_with_base(Some("file:///abs/path/popped-file"))
.into_url_with_base(Some("file:///abs/path/popped-file"))
.unwrap()
.to_string(),
"file:///abs/path/rel/path"
8 changes: 4 additions & 4 deletions src/cargo/util/mod.rs
Original file line number Diff line number Diff line change
@@ -10,6 +10,8 @@ pub use self::errors::{CargoTestError, CliError, ProcessError};
pub use self::flock::{FileLock, Filesystem};
pub use self::graph::Graph;
pub use self::hex::{hash_u64, short_hash, to_hex};
pub use self::into_url::IntoUrl;
pub use self::into_url_with_base::IntoUrlWithBase;
pub use self::lev_distance::lev_distance;
pub use self::lockserver::{LockServer, LockServerClient, LockServerStarted};
pub use self::paths::{bytes2path, dylib_path, join_paths, path2bytes};
@@ -20,8 +22,6 @@ pub use self::read2::read2;
pub use self::rustc::Rustc;
pub use self::sha256::Sha256;
pub use self::to_semver::ToSemver;
pub use self::to_url::ToUrl;
pub use self::to_url_with_base::ToUrlWithBase;
pub use self::vcs::{existing_vcs_repo, FossilRepo, GitRepo, HgRepo, PijulRepo};
pub use self::workspace::{
print_available_benches, print_available_binaries, print_available_examples,
@@ -38,6 +38,8 @@ mod flock;
pub mod graph;
pub mod hex;
pub mod important_paths;
pub mod into_url;
mod into_url_with_base;
pub mod job;
pub mod lev_distance;
mod lockserver;
@@ -51,8 +53,6 @@ mod read2;
pub mod rustc;
mod sha256;
pub mod to_semver;
pub mod to_url;
mod to_url_with_base;
pub mod toml;
mod vcs;
mod workspace;
10 changes: 5 additions & 5 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ use crate::core::{GitReference, PackageIdSpec, SourceId, WorkspaceConfig, Worksp
use crate::sources::{CRATES_IO_INDEX, CRATES_IO_REGISTRY};
use crate::util::errors::{CargoResult, CargoResultExt, ManifestError};
use crate::util::paths;
use crate::util::{self, validate_package_name, Config, ToUrl};
use crate::util::{self, validate_package_name, Config, IntoUrl};

mod targets;
use self::targets::targets;
@@ -1231,7 +1231,7 @@ impl TomlManifest {
_ => cx
.config
.get_registry_index(url)
.or_else(|_| url.to_url())
.or_else(|_| url.into_url())
.chain_err(|| {
format!("[patch] entry `{}` should be a URL or registry name", url)
})?,
@@ -1403,7 +1403,7 @@ impl DetailedTomlDependency {
.or_else(|| self.tag.clone().map(GitReference::Tag))
.or_else(|| self.rev.clone().map(GitReference::Rev))
.unwrap_or_else(|| GitReference::Branch("master".to_string()));
let loc = git.to_url()?;
let loc = git.into_url()?;
SourceId::for_git(&loc, reference)?
}
(None, Some(path), _, _) => {
@@ -1426,7 +1426,7 @@ impl DetailedTomlDependency {
}
(None, None, Some(registry), None) => SourceId::alt_registry(cx.config, registry)?,
(None, None, None, Some(registry_index)) => {
let url = registry_index.to_url()?;
let url = registry_index.into_url()?;
SourceId::for_registry(&url)?
}
(None, None, None, None) => SourceId::crates_io(cx.config)?,
@@ -1455,7 +1455,7 @@ impl DetailedTomlDependency {
dep.set_registry_id(registry_id);
}
if let Some(registry_index) = &self.registry_index {
let url = registry_index.to_url()?;
let url = registry_index.into_url()?;
let registry_id = SourceId::for_registry(&url)?;
dep.set_registry_id(registry_id);
}
4 changes: 2 additions & 2 deletions tests/testsuite/alt_registry.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::support::publish::validate_alt_upload;
use crate::support::registry::{self, Package};
use crate::support::{basic_manifest, git, paths, project};
use cargo::util::ToUrl;
use cargo::util::IntoUrl;
use std::fs::{self, File};
use std::io::Write;

@@ -249,7 +249,7 @@ fn registry_incompatible_with_git() {
#[cargo_test]
fn cannot_publish_to_crates_io_with_registry_dependency() {
let fakeio_path = paths::root().join("fake.io");
let fakeio_url = fakeio_path.to_url().unwrap();
let fakeio_url = fakeio_path.into_url().unwrap();
let p = project()
.file(
"Cargo.toml",