Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions src/cargo/core/resolver/dep_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,8 @@ fn build_requirements<'a, 'b: 'a>(
}
}

if opts.uses_default_features {
if s.features().contains_key("default") {
reqs.require_feature(InternedString::new("default"))?;
}
if opts.uses_default_features && s.features().contains_key("default") {
reqs.require_feature(InternedString::new("default"))?;
}

Ok(reqs)
Expand Down
8 changes: 4 additions & 4 deletions src/cargo/core/resolver/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ impl EncodableResolve {
let mut map = HashMap::new();
for (id, _) in live_pkgs.values() {
map.entry(id.name().as_str())
.or_insert(HashMap::new())
.or_insert_with(HashMap::new)
.entry(id.version().to_string())
.or_insert(HashMap::new())
.or_insert_with(HashMap::new)
.insert(id.source_id(), *id);
}

Expand Down Expand Up @@ -317,7 +317,7 @@ impl EncodableResolve {
// If `checksum` was listed in `[metadata]` but we were previously
// listed as `V2` then assume some sort of bad git merge happened, so
// discard all checksums and let's regenerate them later.
if to_remove.len() > 0 && version == ResolveVersion::V2 {
if !to_remove.is_empty() && version == ResolveVersion::V2 {
checksums.drain();
}
for k in to_remove {
Expand Down Expand Up @@ -542,7 +542,7 @@ impl<'a> ser::Serialize for Resolve {
dependencies: None,
replace: None,
checksum: match self.version() {
ResolveVersion::V2 => self.checksums().get(&id).and_then(|x| x.clone()),
ResolveVersion::V2 => self.checksums().get(id).and_then(|x| x.clone()),
ResolveVersion::V1 => None,
},
})
Expand Down
2 changes: 2 additions & 0 deletions src/cargo/core/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ mod imp {
pub fn stderr_width() -> Option<usize> {
unsafe {
let mut winsize: libc::winsize = mem::zeroed();
// The .into() here is needed for FreeBSD which defines TIOCGWINSZ
// as c_uint but ioctl wants c_ulong.
if libc::ioctl(libc::STDERR_FILENO, libc::TIOCGWINSZ.into(), &mut winsize) < 0 {
return None;
}
Expand Down
3 changes: 3 additions & 0 deletions src/cargo/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#![allow(clippy::trivially_copy_pass_by_ref)]
// exhaustively destructuring ensures future fields are handled
#![allow(clippy::unneeded_field_pattern)]
// false positives in target-specific code, for details see
// https://github.com/rust-lang/cargo/pull/7251#pullrequestreview-274914270
#![allow(clippy::identity_conversion)]

use std::fmt;
use std::io;
Expand Down
6 changes: 3 additions & 3 deletions src/cargo/sources/git/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl GitRemote {
fn fetch_into(&self, dst: &mut git2::Repository, cargo_config: &Config) -> CargoResult<()> {
// Create a local anonymous remote in the repository to fetch the url
let refspec = "refs/heads/*:refs/heads/*";
fetch(dst, &self.url.as_str(), refspec, cargo_config)
fetch(dst, self.url.as_str(), refspec, cargo_config)
}

fn clone_into(&self, dst: &Path, cargo_config: &Config) -> CargoResult<git2::Repository> {
Expand All @@ -152,7 +152,7 @@ impl GitRemote {
let mut repo = init(dst, true)?;
fetch(
&mut repo,
&self.url.as_str(),
self.url.as_str(),
"refs/heads/*:refs/heads/*",
cargo_config,
)?;
Expand Down Expand Up @@ -395,7 +395,7 @@ impl<'a> GitCheckout<'a> {
};
// Fetch data from origin and reset to the head commit
let refspec = "refs/heads/*:refs/heads/*";
fetch(&mut repo, &url, refspec, cargo_config).chain_err(|| {
fetch(&mut repo, url, refspec, cargo_config).chain_err(|| {
internal(format!(
"failed to fetch submodule `{}` from {}",
child.name().unwrap_or(""),
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ impl Execs {
// hidden characters
let matcher = matcher.replace("\t", "<tab>");

return matcher;
matcher
}

fn match_std(
Expand Down Expand Up @@ -1410,7 +1410,7 @@ enum MatchKind {
/// - `[ROOT]` the path to the test directory's root
/// - `[CWD]` is the working directory of the process that was run.
pub fn lines_match(expected: &str, mut actual: &str) -> bool {
let expected = substitute_macros(&expected);
let expected = substitute_macros(expected);
for (i, part) in expected.split("[..]").enumerate() {
match actual.find(part) {
Some(j) => {
Expand Down