Skip to content

Commit

Permalink
Delete dead deserialization code
Browse files Browse the repository at this point in the history
Summary:
All of this is correctly flagged as dead code by Rust 1.79+.

There should be no reason for Reindeer to be deserializing the `categories` and `keywords` and `publish` setting of manifests.

The audit autofix stuff was deleted in {D52243526}.

Reviewed By: JakobDegen

Differential Revision: D59622902

fbshipit-source-id: d0b3698b7b6b95357eec9b26bb67acea79b1b2c7
  • Loading branch information
David Tolnay authored and facebook-github-bot committed Jul 11, 2024
1 parent 8837658 commit 04bf55d
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 54 deletions.
8 changes: 0 additions & 8 deletions example/third-party/reindeer.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ gitignore_checksum_exclude = [".gitignore"]
checksum_exclude = [
]

# Configuration for rustsec auditing
[audit]
# Name of a package which is expected to always have an advisory to make sure
# the mechanism is working.
never_autofix = [
"rustsec-example-crate", # never fix because this is a canary
]

# Platforms we want to support.
#
# A Reindeer platform is a collection of predicates, which are closely related
Expand Down
28 changes: 0 additions & 28 deletions src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
//! get metadata about a crate. It also defines all the types for deserializing from Cargo's
//! JSON output.
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::env;
use std::fmt;
Expand Down Expand Up @@ -247,13 +246,6 @@ pub struct Metadata {
pub resolve: Resolve,
}

#[derive(Debug, Deserialize)]
#[serde(untagged)]
pub enum VecStringOrBool {
VecString(Vec<String>),
Bool(bool),
}

/// Package manifest
// https://doc.rust-lang.org/cargo/reference/manifest.html#the-package-section
#[derive(Debug, Deserialize)]
Expand All @@ -264,8 +256,6 @@ pub struct Manifest {
pub version: semver::Version,
/// Canonical ID for package
pub id: PkgId,
/// License name
pub license: Option<String>,
/// Path to license
pub license_file: Option<PathBuf>,
/// Package description
Expand All @@ -278,33 +268,15 @@ pub struct Manifest {
/// Targets in package
#[serde(deserialize_with = "deserialize_default_from_null")]
pub targets: BTreeSet<ManifestTarget>,
/// Features - mapping from feature name to additional features or dependencies
#[serde(deserialize_with = "deserialize_default_from_null")]
pub features: BTreeMap<String, Vec<String>>,
/// Path to Cargo.toml
pub manifest_path: PathBuf,
/// Additional arbitrary metadata
#[serde(deserialize_with = "deserialize_default_from_null")]
pub metadata: BTreeMap<String, serde_json::Value>,
/// List of authors
#[serde(deserialize_with = "deserialize_default_from_null")]
pub authors: Vec<String>,
/// List of categories in crates.io
#[serde(deserialize_with = "deserialize_default_from_null")]
pub categories: BTreeSet<String>,
/// List of keywords in crates.io
#[serde(deserialize_with = "deserialize_default_from_null")]
pub keywords: BTreeSet<String>,
/// Path to README file
pub readme: Option<PathBuf>,
/// Source repository
pub repository: Option<String>,
/// Default edition for the package (if targets don't have it)
pub edition: Edition,
/// Native library which should be linked to package(? All targets?)
#[serde(deserialize_with = "deserialize_default_from_null")]
pub links: Option<String>,
pub publish: Option<VecStringOrBool>,
}

impl Manifest {
Expand Down
11 changes: 0 additions & 11 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ pub struct Config {
)]
pub vendor: Option<VendorConfig>,

#[serde(default)]
pub audit: AuditConfig,

#[serde(default = "default_platforms")]
pub platform: HashMap<PlatformName, PlatformConfig>,

Expand Down Expand Up @@ -165,14 +162,6 @@ pub struct VendorConfig {
pub checksum_exclude: HashSet<String>,
}

#[derive(Debug, Default, Clone, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct AuditConfig {
/// List of package names to never attempt to autofix
#[serde(default)]
pub never_autofix: HashSet<String>,
}

#[derive(Clone)]
pub struct StringWithDefault<T> {
pub value: String,
Expand Down
7 changes: 0 additions & 7 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use std::collections::BTreeSet;
use std::collections::HashMap;

use anyhow::Context as _;
use serde::Deserialize;

use crate::buck::Name;
use crate::cargo::DepKind;
Expand Down Expand Up @@ -47,12 +46,6 @@ pub struct Index<'meta> {
public_targets: BTreeMap<(&'meta PkgId, TargetReq<'meta>), Option<&'meta str>>,
}

/// Extra per-package metadata to be kept in sync with the package list
#[derive(Debug, Deserialize)]
pub struct ExtraMetadata {
pub oncall: String, // oncall shortname for use as maintainer
}

#[derive(Debug, Clone)]
pub struct ResolvedDep<'meta> {
pub package: &'meta Manifest,
Expand Down

0 comments on commit 04bf55d

Please sign in to comment.