Skip to content

Fix formatting issues with cargo fmt #5261

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 1 commit into from
Mar 29, 2018
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
30 changes: 20 additions & 10 deletions src/cargo/core/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,30 @@ impl ser::Serialize for TargetKind {
#[derive(Clone, PartialEq, Eq, Debug, Hash, Serialize)]
pub struct Profile {
pub opt_level: String,
#[serde(skip_serializing)] pub lto: Lto,
#[serde(skip_serializing)] pub codegen_units: Option<u32>, // None = use rustc default
#[serde(skip_serializing)] pub rustc_args: Option<Vec<String>>,
#[serde(skip_serializing)] pub rustdoc_args: Option<Vec<String>>,
#[serde(skip_serializing)]
pub lto: Lto,
#[serde(skip_serializing)]
pub codegen_units: Option<u32>, // None = use rustc default
#[serde(skip_serializing)]
pub rustc_args: Option<Vec<String>>,
#[serde(skip_serializing)]
pub rustdoc_args: Option<Vec<String>>,
pub debuginfo: Option<u32>,
pub debug_assertions: bool,
pub overflow_checks: bool,
#[serde(skip_serializing)] pub rpath: bool,
#[serde(skip_serializing)]
pub rpath: bool,
pub test: bool,
#[serde(skip_serializing)] pub doc: bool,
#[serde(skip_serializing)] pub run_custom_build: bool,
#[serde(skip_serializing)] pub check: bool,
#[serde(skip_serializing)] pub panic: Option<String>,
#[serde(skip_serializing)] pub incremental: bool,
#[serde(skip_serializing)]
pub doc: bool,
#[serde(skip_serializing)]
pub run_custom_build: bool,
#[serde(skip_serializing)]
pub check: bool,
#[serde(skip_serializing)]
pub panic: Option<String>,
#[serde(skip_serializing)]
pub incremental: bool,
}

#[derive(Clone, PartialEq, Eq, Debug, Hash)]
Expand Down
3 changes: 2 additions & 1 deletion src/cargo/core/resolver/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ pub struct EncodableResolve {
root: Option<EncodableDependency>,
metadata: Option<Metadata>,

#[serde(default, skip_serializing_if = "Patch::is_empty")] patch: Patch,
#[serde(default, skip_serializing_if = "Patch::is_empty")]
patch: Patch,
}

#[derive(Serialize, Deserialize, Debug, Default)]
Expand Down
3 changes: 2 additions & 1 deletion src/cargo/ops/cargo_output_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ pub struct ExportInfo {
/// format for `PackageId`s
#[derive(Serialize)]
struct MetadataResolve {
#[serde(rename = "nodes", serialize_with = "serialize_resolve")] resolve: Resolve,
#[serde(rename = "nodes", serialize_with = "serialize_resolve")]
resolve: Resolve,
root: Option<PackageId>,
}

Expand Down
3 changes: 2 additions & 1 deletion src/cargo/ops/cargo_rustc/fingerprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ pub struct Fingerprint {
#[serde(serialize_with = "serialize_deps", deserialize_with = "deserialize_deps")]
deps: Vec<(String, Arc<Fingerprint>)>,
local: Vec<LocalFingerprint>,
#[serde(skip_serializing, skip_deserializing)] memoized_hash: Mutex<Option<u64>>,
#[serde(skip_serializing, skip_deserializing)]
memoized_hash: Mutex<Option<u64>>,
rustflags: Vec<String>,
epoch: Epoch,
}
Expand Down
9 changes: 6 additions & 3 deletions src/cargo/sources/git/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ impl GitShortID {
/// `GitDatabase`.
#[derive(PartialEq, Clone, Debug, Serialize)]
pub struct GitRemote {
#[serde(serialize_with = "serialize_str")] url: Url,
#[serde(serialize_with = "serialize_str")]
url: Url,
}

/// `GitDatabase` is a local clone of a remote repository's database. Multiple
Expand All @@ -59,7 +60,8 @@ pub struct GitRemote {
pub struct GitDatabase {
remote: GitRemote,
path: PathBuf,
#[serde(skip_serializing)] repo: git2::Repository,
#[serde(skip_serializing)]
repo: git2::Repository,
}

/// `GitCheckout` is a local checkout of a particular revision. Calling
Expand All @@ -70,7 +72,8 @@ pub struct GitCheckout<'a> {
database: &'a GitDatabase,
location: PathBuf,
revision: GitRevision,
#[serde(skip_serializing)] repo: git2::Repository,
#[serde(skip_serializing)]
repo: git2::Repository,
}

// Implementations
Expand Down
3 changes: 2 additions & 1 deletion src/cargo/sources/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ struct RegistryPackage<'a> {
features: BTreeMap<String, Vec<String>>,
cksum: String,
yanked: Option<bool>,
#[serde(default)] links: Option<String>,
#[serde(default)]
links: Option<String>,
}

struct DependencyList {
Expand Down
7 changes: 4 additions & 3 deletions src/cargo/sources/replaced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ impl<'cfg> Registry for ReplacedSource<'cfg> {
let dep = dep.clone().map_source(to_replace, replace_with);

self.inner
.query(&dep, &mut |summary| {
f(summary.map_source(replace_with, to_replace))
})
.query(
&dep,
&mut |summary| f(summary.map_source(replace_with, to_replace)),
)
.chain_err(|| format!("failed to query replaced source {}", self.to_replace))?;
Ok(())
}
Expand Down
42 changes: 28 additions & 14 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ pub struct DetailedTomlDependency {
features: Option<Vec<String>>,
optional: Option<bool>,
default_features: Option<bool>,
#[serde(rename = "default_features")] default_features2: Option<bool>,
#[serde(rename = "default_features")]
default_features2: Option<bool>,
package: Option<String>,
}

Expand Down Expand Up @@ -347,14 +348,18 @@ impl<'de> de::Deserialize<'de> for U32OrBool {

#[derive(Deserialize, Serialize, Clone, Debug, Default)]
pub struct TomlProfile {
#[serde(rename = "opt-level")] opt_level: Option<TomlOptLevel>,
#[serde(rename = "opt-level")]
opt_level: Option<TomlOptLevel>,
lto: Option<StringOrBool>,
#[serde(rename = "codegen-units")] codegen_units: Option<u32>,
#[serde(rename = "codegen-units")]
codegen_units: Option<u32>,
debug: Option<U32OrBool>,
#[serde(rename = "debug-assertions")] debug_assertions: Option<bool>,
#[serde(rename = "debug-assertions")]
debug_assertions: Option<bool>,
rpath: Option<bool>,
panic: Option<String>,
#[serde(rename = "overflow-checks")] overflow_checks: Option<bool>,
#[serde(rename = "overflow-checks")]
overflow_checks: Option<bool>,
incremental: Option<bool>,
}

Expand Down Expand Up @@ -449,9 +454,11 @@ pub struct TomlProject {
exclude: Option<Vec<String>>,
include: Option<Vec<String>>,
publish: Option<VecStringOrBool>,
#[serde(rename = "publish-lockfile")] publish_lockfile: Option<bool>,
#[serde(rename = "publish-lockfile")]
publish_lockfile: Option<bool>,
workspace: Option<String>,
#[serde(rename = "im-a-teapot")] im_a_teapot: Option<bool>,
#[serde(rename = "im-a-teapot")]
im_a_teapot: Option<bool>,

// package metadata
description: Option<String>,
Expand All @@ -461,7 +468,8 @@ pub struct TomlProject {
keywords: Option<Vec<String>>,
categories: Option<Vec<String>>,
license: Option<String>,
#[serde(rename = "license-file")] license_file: Option<String>,
#[serde(rename = "license-file")]
license_file: Option<String>,
repository: Option<String>,
metadata: Option<toml::Value>,
rust: Option<String>,
Expand All @@ -470,7 +478,8 @@ pub struct TomlProject {
#[derive(Debug, Deserialize, Serialize)]
pub struct TomlWorkspace {
members: Option<Vec<String>>,
#[serde(rename = "default-members")] default_members: Option<Vec<String>>,
#[serde(rename = "default-members")]
default_members: Option<Vec<String>>,
exclude: Option<Vec<String>>,
}

Expand Down Expand Up @@ -1176,19 +1185,24 @@ struct TomlTarget {

// The intention was to only accept `crate-type` here but historical
// versions of Cargo also accepted `crate_type`, so look for both.
#[serde(rename = "crate-type")] crate_type: Option<Vec<String>>,
#[serde(rename = "crate_type")] crate_type2: Option<Vec<String>>,
#[serde(rename = "crate-type")]
crate_type: Option<Vec<String>>,
#[serde(rename = "crate_type")]
crate_type2: Option<Vec<String>>,

path: Option<PathValue>,
test: Option<bool>,
doctest: Option<bool>,
bench: Option<bool>,
doc: Option<bool>,
plugin: Option<bool>,
#[serde(rename = "proc-macro")] proc_macro: Option<bool>,
#[serde(rename = "proc_macro")] proc_macro2: Option<bool>,
#[serde(rename = "proc-macro")]
proc_macro: Option<bool>,
#[serde(rename = "proc_macro")]
proc_macro2: Option<bool>,
harness: Option<bool>,
#[serde(rename = "required-features")] required_features: Option<Vec<String>>,
#[serde(rename = "required-features")]
required_features: Option<Vec<String>>,
}

#[derive(Clone)]
Expand Down