orig: String,
}
+#[non_exhaustive]
#[derive(Debug)]
pub enum ParseErrorKind {
UnterminatedString,
IncompleteExpr(&'static str),
UnterminatedExpression(String),
InvalidTarget(String),
-
- #[doc(hidden)]
- __Nonexhaustive,
}
impl fmt::Display for ParseError {
write!(f, "unexpected content `{}` found after cfg expression", s)
}
InvalidTarget(s) => write!(f, "invalid target specifier: {}", s),
- __Nonexhaustive => unreachable!(),
}
}
}
if a.name != b.name {
let e = format_err!("`{}` != `{}`", a.name, b.name)
.context("unit dependency name changed");
- return Err(e.into());
+ return Err(e);
}
if a.fingerprint.hash() != b.fingerprint.hash() {
b.fingerprint.hash()
)
.context("unit dependency information changed");
- return Err(e.into());
+ return Err(e);
}
}
return Ok(());
}
let map = config.doc_extern_map()?;
- if map.registries.len() == 0 && map.std.is_none() {
+ if map.registries.is_empty() && map.std.is_none() {
// Skip doing unnecessary work.
return Ok(());
}
.keys()
.filter_map(|name| {
if let Ok(index_url) = config.get_registry_index(name) {
- return Some((name, index_url));
+ Some((name, index_url))
} else {
log::warn!(
"`doc.extern-map.{}` specifies a registry that is not defined",
name
);
- return None;
+ None
}
})
.collect();
.expect("loaded source not present");
let summaries = source.query_vec(dep)?;
let (summary, should_unlock) =
- summary_for_patch(orig_patch, &locked, summaries, source).chain_err(|| {
+ summary_for_patch(orig_patch, locked, summaries, source).chain_err(|| {
format!(
"patch for `{}` in `{}` failed to resolve",
orig_patch.package_name(),
let err = anyhow::format_err!("{}", warning.message);
let cx =
anyhow::format_err!("failed to parse manifest at `{}`", path.display());
- return Err(err.context(cx).into());
+ return Err(err.context(cx));
} else {
let msg = if self.root_manifest.is_none() {
warning.message.to_string()
#![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)]
+#![allow(clippy::useless_conversion)]
use crate::core::shell::Verbosity::Verbose;
use crate::core::Shell;
// best-effort check to see if we can avoid hitting the network.
if let Ok(pkg) = select_dep_pkg(source, dep, config, false) {
let (_ws, rustc, target) =
- make_ws_rustc_target(&config, opts, &source.source_id(), pkg.clone())?;
- if let Ok(true) = is_installed(&pkg, config, opts, &rustc, &target, root, &dst, force) {
+ make_ws_rustc_target(config, opts, &source.source_id(), pkg.clone())?;
+ if let Ok(true) = is_installed(&pkg, config, opts, &rustc, &target, root, dst, force) {
return Ok(Some(pkg));
}
}
Err(e) => {
let cx = format!("failed to read directory `{}`", path.display());
let e = anyhow::Error::from(e);
- return Err(e.context(cx).into());
+ return Err(e.context(cx));
}
};
for dir in dirs {
if !error_contended(&e) {
let e = anyhow::Error::from(e);
let cx = format!("failed to lock file: {}", path.display());
- return Err(e.context(cx).into());
+ return Err(e.context(cx));
}
}
}
pub fn exec_replace(process_builder: &ProcessBuilder) -> CargoResult<()> {
let mut command = process_builder.build_command();
let error = command.exec();
- Err(anyhow::Error::from(error)
- .context(process_error(
- &format!("could not execute process {}", process_builder),
- None,
- None,
- ))
- .into())
+ Err(anyhow::Error::from(error).context(process_error(
+ &format!("could not execute process {}", process_builder),
+ None,
+ None,
+ )))
}
}
}
let first_error = anyhow::Error::from(first_error);
- Err(first_error.context("could not parse input as TOML").into())
+ Err(first_error.context("could not parse input as TOML"))
}
type TomlLibTarget = TomlTarget;
#![allow(clippy::blacklisted_name)]
#![allow(clippy::explicit_iter_loop)]
#![allow(clippy::redundant_closure)]
-#![allow(clippy::block_in_if_condition_stmt)] // clippy doesn't agree with rustfmt 😂
+#![allow(clippy::blocks_in_if_conditions)] // clippy doesn't agree with rustfmt 😂
#![allow(clippy::inefficient_to_string)] // this causes suggestions that result in `(*s).to_string()`
#![warn(clippy::needless_borrow)]
#![warn(clippy::redundant_clone)]