no_fail_fast: options.flag_no_fail_fast,
only_doc: false,
compile_opts: ops::CompileOptions {
- config: config,
+ config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|s| &s[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
- spec: spec,
+ spec,
release: true,
mode: ops::CompileMode::Bench,
filter: ops::CompileFilter::new(options.flag_lib,
&options.flag_package)?;
let opts = CompileOptions {
- config: config,
+ config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
- spec: spec,
+ spec,
mode: ops::CompileMode::Build,
release: options.flag_release,
filter: ops::CompileFilter::new(options.flag_lib,
};
let opts = CompileOptions {
- config: config,
+ config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
- spec: spec,
- mode: ops::CompileMode::Check{test:test},
+ spec,
+ mode: ops::CompileMode::Check{test },
release: options.flag_release,
filter: ops::CompileFilter::new(options.flag_lib,
&options.flag_bin, options.flag_bins,
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
let opts = ops::CleanOptions {
- config: config,
+ config,
spec: &options.flag_package,
target: options.flag_target.as_ref().map(|s| &s[..]),
release: options.flag_release,
let doc_opts = ops::DocOptions {
open_result: options.flag_open,
compile_opts: ops::CompileOptions {
- config: config,
+ config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
- spec: spec,
+ spec,
filter: ops::CompileFilter::new(options.flag_lib,
&options.flag_bin, options.flag_bins,
&empty, false,
&options.flag_z)?;
let compile_opts = ops::CompileOptions {
- config: config,
+ config,
jobs: options.flag_jobs,
target: None,
features: &options.flag_features,
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
let ws = Workspace::new(&root, config)?;
ops::package(&ws, &ops::PackageOpts {
- config: config,
+ config,
verify: !options.flag_no_verify,
list: options.flag_list,
check_metadata: !options.flag_no_metadata,
let root = find_root_manifest_for_wd(flag_manifest_path.clone(), config.cwd())?;
let ws = Workspace::new(&root, config)?;
ops::publish(&ws, &ops::PublishOpts {
- config: config,
- token: token,
+ config,
+ token,
index:
if host.clone().is_none() || host.clone().unwrap().is_empty() { index }
else { config.shell().warn(&msg)?; host }, // TODO: Deprecated, remove
verify: !no_verify,
- allow_dirty: allow_dirty,
+ allow_dirty,
target: target.as_ref().map(|t| &t[..]),
- jobs: jobs,
- dry_run: dry_run,
- registry: registry,
+ jobs,
+ dry_run,
+ registry,
})?;
Ok(())
}
let spec = Packages::Packages(&packages);
let compile_opts = ops::CompileOptions {
- config: config,
+ config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
- spec: spec,
+ spec,
release: options.flag_release,
mode: ops::CompileMode::Build,
filter: if examples.is_empty() && bins.is_empty() {
let spec = options.flag_package.map_or_else(Vec::new, |s| vec![s]);
let opts = CompileOptions {
- config: config,
+ config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: Packages::Packages(&spec),
- mode: mode,
+ mode,
release: options.flag_release,
filter: ops::CompileFilter::new(options.flag_lib,
&options.flag_bin, options.flag_bins,
let doc_opts = ops::DocOptions {
open_result: options.flag_open,
compile_opts: ops::CompileOptions {
- config: config,
+ config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
no_fail_fast: options.flag_no_fail_fast,
only_doc: options.flag_doc,
compile_opts: ops::CompileOptions {
- config: config,
+ config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|s| &s[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
- spec: spec,
+ spec,
release: options.flag_release,
- mode: mode,
- filter: filter,
+ mode,
+ filter,
message_format: options.flag_message_format,
target_rustdoc_args: None,
target_rustc_args: None,
aggressive: options.flag_aggressive,
precise: options.flag_precise.as_ref().map(|s| &s[..]),
to_update: &options.flag_package,
- config: config,
+ config,
};
let ws = Workspace::new(&root, config)?;
im_a_teapot: Option<bool>,
original: Rc<TomlManifest>) -> Manifest {
Manifest {
- summary: summary,
- targets: targets,
+ summary,
+ targets,
warnings: Vec::new(),
- exclude: exclude,
- include: include,
- links: links,
- metadata: metadata,
- profiles: profiles,
- publish: publish,
- replace: replace,
- patch: patch,
- workspace: workspace,
- features: features,
- epoch: epoch,
- original: original,
- im_a_teapot: im_a_teapot,
+ exclude,
+ include,
+ links,
+ metadata,
+ profiles,
+ publish,
+ replace,
+ patch,
+ workspace,
+ features,
+ epoch,
+ original,
+ im_a_teapot,
}
}
workspace: WorkspaceConfig,
profiles: Profiles) -> VirtualManifest {
VirtualManifest {
- replace: replace,
- patch: patch,
- workspace: workspace,
- profiles: profiles,
+ replace,
+ patch,
+ workspace,
+ profiles,
}
}
Target {
kind: TargetKind::Bin,
name: name.to_string(),
- required_features: required_features,
+ required_features,
doc: true,
..Target::with_path(src_path)
}
};
Target {
- kind: kind,
+ kind,
name: name.to_string(),
- required_features: required_features,
+ required_features,
benched: false,
..Target::with_path(src_path)
}
Target {
kind: TargetKind::Test,
name: name.to_string(),
- required_features: required_features,
+ required_features,
benched: false,
..Target::with_path(src_path)
}
Target {
kind: TargetKind::Bench,
name: name.to_string(),
- required_features: required_features,
+ required_features,
tested: false,
..Target::with_path(src_path)
}
name: package_id.name(),
version: &package_id.version().to_string(),
id: package_id,
- license: license,
- license_file: license_file,
- description: description,
+ license,
+ license_file,
+ description,
source: summary.source_id(),
dependencies: summary.dependencies(),
targets: self.manifest.targets(),
pub fn new(manifest: Manifest,
manifest_path: &Path) -> Package {
Package {
- manifest: manifest,
+ manifest,
manifest_path: manifest_path.to_path_buf(),
}
}
Ok(PackageId {
inner: Arc::new(PackageIdInner {
name: name.to_string(),
- version: version,
- source_id: source_id,
+ version,
+ source_id,
}),
})
}
}
Ok(PackageIdSpec {
name: name.to_string(),
- version: version,
+ version,
url: None,
})
}
}
};
Ok(PackageIdSpec {
- name: name,
- version: version,
+ name,
+ version,
url: Some(url),
})
}
sources: SourceMap::new(),
source_ids: HashMap::new(),
overrides: Vec::new(),
- source_config: source_config,
+ source_config,
locked: HashMap::new(),
patches: HashMap::new(),
patches_locked: false,
graph: g,
empty_features: HashSet::new(),
features: HashMap::new(),
- replacements: replacements,
- checksums: checksums,
- metadata: metadata,
- unused_patches: unused_patches,
+ replacements,
+ checksums,
+ metadata,
+ unused_patches,
})
}
}
EncodableResolve {
package: Some(encodable),
root: None,
- metadata: metadata,
- patch: patch,
+ metadata,
+ patch,
}.serialize(s)
}
}
version: id.version().to_string(),
source: encode_source(id.source_id()),
dependencies: deps,
- replace: replace,
+ replace,
}
}
fn new(kind: Kind, url: Url) -> CargoResult<SourceId> {
let source_id = SourceId {
inner: Arc::new(SourceIdInner {
- kind: kind,
+ kind,
canonical_url: git::canonicalize_url(&url)?,
- url: url,
+ url,
precise: None,
name: None,
}),
inner: Arc::new(SourceIdInner {
kind: Kind::Registry,
canonical_url: git::canonicalize_url(&url)?,
- url: url,
+ url,
precise: None,
name: Some(key.to_string()),
}),
let foo = Kind::Git(GitReference::Branch("foo".to_string()));
let s3 = SourceId::new(foo, loc).unwrap();
- assert!(s1 != s3);
+ assert_ne!(s1, s3);
}
}
let target_dir = config.target_dir()?;
let mut ws = Workspace {
- config: config,
+ config,
current_manifest: manifest_path.to_path_buf(),
packages: Packages {
- config: config,
+ config,
packages: HashMap::new(),
},
root_manifest: None,
- target_dir: target_dir,
+ target_dir,
members: Vec::new(),
default_members: Vec::new(),
is_ephemeral: false,
target_dir: Option<Filesystem>,
require_optional_deps: bool) -> CargoResult<Workspace<'cfg>> {
let mut ws = Workspace {
- config: config,
+ config,
current_manifest: package.manifest_path().to_path_buf(),
packages: Packages {
- config: config,
+ config,
packages: HashMap::new(),
},
root_manifest: None,
members: Vec::new(),
default_members: Vec::new(),
is_ephemeral: true,
- require_optional_deps: require_optional_deps,
+ require_optional_deps,
};
{
let key = ws.current_manifest.parent().unwrap();
pre_release: option_env_str!("CARGO_PKG_VERSION_PRE"),
cfg_info: Some(CfgInfo {
release_channel: option_env_str!("CFG_RELEASE_CHANNEL").unwrap(),
- commit_info: commit_info,
+ commit_info,
}),
}
},
pub fn default(config: &'a Config, mode: CompileMode) -> CompileOptions<'a>
{
CompileOptions {
- config: config,
+ config,
jobs: None,
target: None,
features: &[],
all_features: false,
no_default_features: false,
spec: ops::Packages::Packages(&[]),
- mode: mode,
+ mode,
release: false,
filter: CompileFilter::Default { required_features_filterable: false },
message_format: MessageFormat::Human,
targets.iter().filter(|t| t.benched()).map(|t| {
BuildProposal {
target: t,
- profile: profile,
+ profile,
required: !required_features_filterable,
}
}).collect::<Vec<_>>()
t.is_bin() || t.is_lib()
}).map(|t| BuildProposal {
target: t,
- profile: profile,
+ profile,
required: !required_features_filterable,
}).collect()
}
)
}).map(|t| BuildProposal {
target: t,
- profile: profile,
+ profile,
required: !required_features_filterable,
}).collect()
}
if t.doctested() {
return vec![BuildProposal {
target: t,
- profile: profile,
+ profile,
required: !required_features_filterable,
}];
}
let result = pkg.targets().iter().filter(|t| is_expected_kind(t)).map(|t| {
BuildProposal {
target: t,
- profile: profile,
+ profile,
required: false,
}
});
debug!("found {} `{}`", desc, name);
targets.push(BuildProposal {
target: t,
- profile: profile,
+ profile,
required: true,
});
}
if let Some(t) = pkg.targets().iter().find(|t| t.is_lib()) {
targets.push(BuildProposal {
target: t,
- profile: profile,
+ profile,
required: true,
});
} else if !all_targets {
let mut base = ops::BuildConfig {
host_triple: config.rustc()?.host.clone(),
requested_target: target.clone(),
- jobs: jobs,
+ jobs,
..Default::default()
};
base.host = scrape_target_config(config, &base.host_triple)?;
let mkopts = MkOptions {
version_control: opts.version_control,
path: &path,
- name: name,
+ name,
source_files: vec![plan_new_source_file(opts.kind.is_bin(), name.to_string())],
bin: opts.kind.is_bin(),
};
None => None
};
Ok(CargoNewConfig {
- name: name,
- email: email,
+ name,
+ email,
version_control: vcs,
})
}
.collect::<CargoResult<Vec<_>>>()?;
Ok(ExportInfo {
- packages: packages,
+ packages,
workspace_members: ws.members().map(|pkg| pkg.package_id().clone()).collect(),
resolve: Some(MetadataResolve{
- resolve: resolve,
+ resolve,
root: ws.current_opt().map(|pkg| pkg.package_id().clone()),
}),
target_directory: ws.target_dir().display().to_string(),
resolve.iter().map(|id| {
Node {
- id: id,
+ id,
dependencies: resolve.deps(id).collect(),
}
}).collect::<Vec<_>>().serialize(s)
let ws = Workspace::ephemeral(new_pkg, config, None, true)?;
ops::compile_ws(&ws, None, &ops::CompileOptions {
- config: config,
+ config,
jobs: opts.jobs,
target: opts.target,
features: &[],
to_doc_test: Vec::new(),
cfgs: HashMap::new(),
rustdocflags: HashMap::new(),
- config: config,
+ config,
target: String::new(),
target_runner: LazyCell::new(),
}
};
Ok(Context {
- ws: ws,
+ ws,
host: host_layout,
target: target_layout,
- resolve: resolve,
- packages: packages,
- config: config,
+ resolve,
+ packages,
+ config,
target_info: TargetInfo::default(),
host_info: TargetInfo::default(),
compilation: Compilation::new(config),
build_state: Arc::new(BuildState::new(&build_config)),
- build_config: build_config,
+ build_config,
fingerprints: HashMap::new(),
- profiles: profiles,
+ profiles,
compiled: HashSet::new(),
build_scripts: HashMap::new(),
build_explicit_deps: HashMap::new(),
links: Links::new(),
used_in_plugin: HashSet::new(),
incremental_env,
- jobserver: jobserver,
+ jobserver,
build_script_overridden: HashSet::new(),
// TODO: Pre-Calculate these with a topo-sort, rather than lazy-calculating
}
let cfg = if has_cfg_and_sysroot {
- Some(try!(lines.map(Cfg::from_str).collect()))
+ Some(lines.map(Cfg::from_str).collect::<CargoResult<_>>()?)
} else {
None
};
Ok(pkg) => {
pkg.targets().iter().find(|t| t.is_lib()).map(|t| {
let unit = Unit {
- pkg: pkg,
+ pkg,
target: t,
profile: self.lib_or_check_profile(unit, t),
kind: unit.kind.for_target(t),
}
BuildState {
outputs: Mutex::new(HashMap::new()),
- overrides: overrides,
+ overrides,
}
}
}
Ok(BuildOutput {
- library_paths: library_paths,
- library_links: library_links,
- cfgs: cfgs,
- env: env,
- metadata: metadata,
- rerun_if_changed: rerun_if_changed,
- rerun_if_env_changed: rerun_if_env_changed,
- warnings: warnings,
+ library_paths,
+ library_links,
+ cfgs,
+ env,
+ metadata,
+ rerun_if_changed,
+ rerun_if_env_changed,
+ warnings,
})
}
// actually affect the output artifact so there's no need to hash it.
path: util::hash_u64(&super::path_args(cx, unit).0),
features: format!("{:?}", cx.resolve.features_sorted(unit.pkg.package_id())),
- deps: deps,
+ deps,
local: vec![local],
memoized_hash: Mutex::new(None),
epoch: unit.pkg.manifest().epoch(),
path: 0,
features: String::new(),
deps: Vec::new(),
- local: local,
+ local,
memoized_hash: Mutex::new(None),
epoch: Epoch::Epoch2015,
rustflags: Vec::new(),
impl Job {
/// Create a new job representing a unit of work.
pub fn new(dirty: Work, fresh: Work) -> Job {
- Job { dirty: dirty, fresh: fresh }
+ Job { dirty, fresh }
}
/// Consumes this job by running it, returning the result of the
let (tx, rx) = channel();
JobQueue {
queue: DependencyQueue::new(),
- tx: tx,
- rx: rx,
+ tx,
+ rx,
active: 0,
pending: HashMap::new(),
compiled: HashSet::new(),
incremental: root.join("incremental"),
fingerprint: root.join(".fingerprint"),
examples: root.join("examples"),
- root: root,
+ root,
_lock: lock,
})
}
};
targets.iter().map(move |&(target, profile)| {
Unit {
- pkg: pkg,
- target: target,
- profile: profile,
+ pkg,
+ target,
+ profile,
kind: if target.for_host() {Kind::Host} else {default_kind},
}
})
package_id: &package_id,
target: &target,
profile: &profile,
- features: features,
+ features,
filenames: destinations,
- fresh: fresh,
+ fresh,
});
}
Ok(())
let publish = registry.publish(&NewCrate {
name: pkg.name().to_string(),
vers: pkg.version().to_string(),
- deps: deps,
+ deps,
features: pkg.summary().features().clone(),
authors: authors.clone(),
description: description.clone(),
};
Ok(RegistryConfig {
- index: index,
- token: token
+ index,
+ token
})
}
// for any other packages specified with `-p`.
Method::Required { dev_deps, .. } => {
let base = Method::Required {
- dev_deps: dev_deps,
+ dev_deps,
features: &[],
uses_default_features: true,
};
let mut base = SourceConfigMap {
cfgs: HashMap::new(),
id2name: HashMap::new(),
- config: config,
+ config,
};
base.add("crates-io", SourceConfig {
id: SourceId::crates_io(config)?,
self.add(name, SourceConfig {
id: src,
- replace_with: replace_with,
+ replace_with,
});
return Ok(());
DirectorySource {
source_id: id.clone(),
root: path.to_path_buf(),
- config: config,
+ config,
packages: HashMap::new(),
}
}
};
let source = GitSource {
- remote: remote,
- reference: reference,
+ remote,
+ reference,
source_id: source_id.clone(),
path_source: None,
rev: None,
- ident: ident,
- config: config,
+ ident,
+ config,
};
Ok(source)
Ok(GitDatabase {
remote: self.clone(),
path: into.to_path_buf(),
- repo: repo,
+ repo,
})
}
Ok(GitDatabase {
remote: self.clone(),
path: db_path.to_path_buf(),
- repo: repo,
+ repo,
})
}
{
GitCheckout {
location: path.to_path_buf(),
- database: database,
- revision: revision,
- repo: repo,
+ database,
+ revision,
+ repo,
}
}
path: path.to_path_buf(),
updated: false,
packages: Vec::new(),
- config: config,
+ config,
recursive: false,
}
}
path: path.clone(),
cache: HashMap::new(),
hashes: HashMap::new(),
- config: config,
- locked: locked,
+ config,
+ locked,
}
}
src_path: config.registry_source_path().join(name),
index_path: Filesystem::new(root.join("index")),
root: Filesystem::new(root.to_path_buf()),
- config: config,
+ config,
}
}
}
index_locked: bool) -> RegistrySource<'cfg> {
RegistrySource {
src_path: config.registry_source_path().join(name),
- config: config,
+ config,
source_id: source_id.clone(),
updated: false,
index: index::RegistryIndex::new(source_id,
ops.index_path(),
config,
index_locked),
- index_locked: index_locked,
- ops: ops,
+ index_locked,
+ ops,
}
}
index_path: config.registry_index_path().join(name),
cache_path: config.registry_cache_path().join(name),
source_id: source_id.clone(),
- config: config,
+ config,
tree: RefCell::new(None),
repo: LazyCell::new(),
head: Cell::new(None),
home_path: Filesystem::new(homedir),
shell: RefCell::new(shell),
rustc: LazyCell::new(),
- cwd: cwd,
+ cwd,
values: LazyCell::new(),
cargo_exe: LazyCell::new(),
rustdoc: LazyCell::new(),
.collect::<Vec<String>>()
.join("\n");
CargoTestError {
- test: test,
- desc: desc,
+ test,
+ desc,
exit: errors[0].exit,
causes: errors,
}
}
return ProcessError {
- desc: desc,
+ desc,
exit: status.cloned(),
output: output.cloned(),
};
state: State,
}
-#[derive(PartialEq)]
+#[derive(PartialEq, Debug)]
enum State {
Unlocked,
Shared,
/// Note that special care must be taken to ensure that the path is not
/// referenced outside the lifetime of this lock.
pub fn path(&self) -> &Path {
- assert!(self.state != State::Unlocked);
+ assert_ne!(self.state, State::Unlocked);
&self.path
}
/// Returns the parent path containing this file
pub fn parent(&self) -> &Path {
- assert!(self.state != State::Unlocked);
+ assert_ne!(self.state, State::Unlocked);
self.path.parent().unwrap()
}
State::Unlocked => {}
}
- Ok(FileLock { f: Some(f), path: path, state: state })
+ Ok(FileLock { f: Some(f), path, state })
}
}
return None
}
- Some(Setup { job: job })
+ Some(Setup { job })
}
impl Drop for Setup {
None)
})?;
let output = Output {
- stdout: stdout,
- stderr: stderr,
- status: status,
+ stdout,
+ stderr,
+ status,
};
{
impl<'a> Pipe<'a> {
unsafe fn new<P: IntoRawHandle>(p: P, dst: &'a mut Vec<u8>) -> Pipe<'a> {
Pipe {
- dst: dst,
+ dst,
pipe: NamedPipe::from_raw_handle(p.into_raw_handle()),
overlapped: Overlapped::zero(),
done: false,
};
Ok(Rustc {
- path: path,
- wrapper: wrapper,
- verbose_version: verbose_version,
- host: host,
+ path,
+ wrapper,
+ verbose_version,
+ host,
})
}
formatter.write_str("a boolean or an integer")
}
- fn visit_i64<E>(self, u: i64) -> Result<Self::Value, E>
+ fn visit_bool<E>(self, b: bool) -> Result<Self::Value, E>
where E: de::Error,
{
- Ok(U32OrBool::U32(u as u32))
+ Ok(U32OrBool::Bool(b))
}
- fn visit_u64<E>(self, u: u64) -> Result<Self::Value, E>
+ fn visit_i64<E>(self, u: i64) -> Result<Self::Value, E>
where E: de::Error,
{
Ok(U32OrBool::U32(u as u32))
}
- fn visit_bool<E>(self, b: bool) -> Result<Self::Value, E>
+ fn visit_u64<E>(self, u: u64) -> Result<Self::Value, E>
where E: de::Error,
{
- Ok(U32OrBool::Bool(b))
+ Ok(U32OrBool::U32(u as u32))
}
}
formatter.write_str("a boolean or a string")
}
- fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
+ fn visit_bool<E>(self, b: bool) -> Result<Self::Value, E>
where E: de::Error,
{
- Ok(StringOrBool::String(s.to_string()))
+ Ok(StringOrBool::Bool(b))
}
- fn visit_bool<E>(self, b: bool) -> Result<Self::Value, E>
+ fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
where E: de::Error,
{
- Ok(StringOrBool::Bool(b))
+ Ok(StringOrBool::String(s.to_string()))
}
}
let mut cx = Context {
pkgid: Some(&pkgid),
deps: &mut deps,
- source_id: source_id,
+ source_id,
nested_paths: &mut nested_paths,
- config: config,
+ config,
warnings: &mut warnings,
features: &features,
platform: None,
let mut cx = Context {
pkgid: None,
deps: &mut deps,
- source_id: source_id,
+ source_id,
nested_paths: &mut nested_paths,
- config: config,
+ config,
warnings: &mut warnings,
platform: None,
features: &features,
- root: root
+ root
};
(me.replace(&mut cx)?, me.patch(&mut cx)?)
};
Some(StringOrBool::String(ref n)) => Lto::Named(n.clone()),
None => profile.lto,
},
- codegen_units: codegen_units,
+ codegen_units,
rustc_args: None,
rustdoc_args: None,
debuginfo: debug.unwrap_or(profile.debuginfo),
token: Option<String>,
handle: Easy) -> Registry {
Registry {
- host: host,
- token: token,
- handle: handle,
+ host,
+ token,
+ handle,
}
}
.unwrap_or_else(Vec::new);
Ok(Warnings {
- invalid_categories: invalid_categories,
- invalid_badges: invalid_badges,
+ invalid_categories,
+ invalid_badges,
})
}
t!(config.set_str("user.name", "name"));
t!(config.set_str("user.email", "email"));
}
- RepoBuilder { repo: repo, files: Vec::new() }
+ RepoBuilder { repo, files: Vec::new() }
}
pub fn file(self, path: &str, contents: &str) -> RepoBuilder {
impl FileBuilder {
pub fn new(path: PathBuf, body: &str) -> FileBuilder {
- FileBuilder { path: path, body: body.to_string() }
+ FileBuilder { path, body: body.to_string() }
}
fn mk(&self) {
impl SymlinkBuilder {
pub fn new(dst: PathBuf, src: PathBuf) -> SymlinkBuilder {
- SymlinkBuilder { dst: dst, src: src }
+ SymlinkBuilder { dst, src }
}
#[cfg(unix)]
assert!(r.len() > 0);
Some((&l[0], &r[0]))
} else {
- assert!(r.len() == 0);
+ assert_eq!(r.len(), 0);
None
}
}
self.move_in_time(|sec, nsec| (sec + 3600, nsec))
}
- fn move_in_time<F>(&self, F)
+ fn move_in_time<F>(&self, travel_amount: F)
where F: Fn(u64, u32) -> (u64, u32);
}
let mut lock2 = String::new();
t!(t!(File::open(p.root().join("Cargo.lock"))).read_to_string(&mut lock2));
- assert!(lock1 == lock2, "lock files changed");
+ assert_eq!(lock1, lock2, "lock files changed");
}
#[test]
assert_that(p.cargo("generate-lockfile"),
execs().with_status(0));
let lock2 = p.read_lockfile();
- assert!(lock1 != lock2);
+ assert_ne!(lock1, lock2);
// change the dep
File::create(&p.root().join("bar/Cargo.toml")).unwrap().write_all(br#"
assert_that(p.cargo("generate-lockfile"),
execs().with_status(0));
let lock3 = p.read_lockfile();
- assert!(lock1 != lock3);
- assert!(lock2 != lock3);
+ assert_ne!(lock1, lock3);
+ assert_ne!(lock2, lock3);
// remove the dep
println!("lock4");
let lock = p.read_lockfile();
assert_that(p.cargo("install"), execs().with_status(0));
let lock2 = p.read_lockfile();
- assert!(lock == lock2, "different lockfiles");
+ assert_eq!(lock, lock2, "different lockfiles");
}
#[test]
assert!(lock_file1.contains("bar"));
assert_eq!(lock_file2, lock_file3);
- assert!(lock_file1 != lock_file2);
+ assert_ne!(lock_file1, lock_file2);
}
#[test]