Make the latest Clippy happy

This commit is contained in:
Peter Williams 2023-03-29 09:47:35 -04:00
parent 7ee80aefab
commit 887e8e1fb4
6 changed files with 19 additions and 65 deletions

View File

@ -714,11 +714,12 @@ pub struct SecuritySettings {
/// Different high-level security stances that can be adopted when creating
/// [`SecuritySettings`].
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub enum SecurityStance {
/// Ensure that all known-insecure features are disabled.
///
/// Use this stance if you are processing untrusted input.
#[default]
DisableInsecures,
/// Request to allow the use of known-insecure features.
@ -730,13 +731,6 @@ pub enum SecurityStance {
MaybeAllowInsecures,
}
impl Default for SecurityStance {
fn default() -> Self {
// Obvi, the default is secure!!!
SecurityStance::DisableInsecures
}
}
impl SecuritySettings {
/// Create a new security configuration.
///

View File

@ -14,21 +14,16 @@ use std::{
};
/// Supported depedency-finding backends.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum Backend {
/// pkg-config
#[default]
PkgConfig,
/// vcpkg
Vcpkg,
}
impl Default for Backend {
fn default() -> Self {
Backend::PkgConfig
}
}
/// Dep-finding configuration.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Configuration {

View File

@ -322,7 +322,7 @@ impl AssetSpecification {
/// Produce the TeX paths of the output files associated with this
/// specification.
pub fn output_paths<'a>(&'a self) -> impl Iterator<Item = Cow<'a, str>> {
pub fn output_paths(&self) -> impl Iterator<Item = Cow<'_, str>> {
AssetOutputsIterator {
iter: self.0 .0.iter(),
cur_vg_path: None,

View File

@ -38,19 +38,14 @@ pub struct Spx2HtmlEngine {
do_not_emit_assets: bool,
}
#[derive(Debug)]
#[derive(Debug, Default)]
enum OutputState {
#[default]
Undefined,
NoOutput,
Path(PathBuf),
}
impl Default for OutputState {
fn default() -> Self {
OutputState::Undefined
}
}
impl Spx2HtmlEngine {
/// Emit an asset specification file and not actual assets.
///

View File

@ -32,12 +32,13 @@ pub enum MessageKind {
/// A setting regarding which messages to display.
#[repr(usize)]
#[non_exhaustive]
#[derive(Clone, Copy, Eq, Debug)]
#[derive(Clone, Copy, Debug, Default, Eq)]
pub enum ChatterLevel {
/// Suppress all informational output.
Minimal = 0,
/// Normal output levels.
#[default]
Normal,
}
@ -52,12 +53,6 @@ impl ChatterLevel {
}
}
impl Default for ChatterLevel {
fn default() -> Self {
ChatterLevel::Normal
}
}
impl FromStr for ChatterLevel {
type Err = &'static str;

View File

@ -116,7 +116,7 @@ impl FileSummary {
}
/// The different types of output files that tectonic knows how to produce.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum OutputFormat {
/// A '.aux' file.
Aux,
@ -125,6 +125,7 @@ pub enum OutputFormat {
/// An extended DVI file.
Xdv,
/// A '.pdf' file.
#[default]
Pdf,
/// A '.fmt' file, for initializing the TeX engine.
Format,
@ -145,17 +146,12 @@ impl FromStr for OutputFormat {
}
}
impl Default for OutputFormat {
fn default() -> OutputFormat {
OutputFormat::Pdf
}
}
/// The different types of "passes" that [`ProcessingSession`] knows how to run. See
/// [`ProcessingSession::run`] for more details.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum PassSetting {
/// The default pass, which repeatedly runs TeX and BibTeX until it doesn't need to any more.
#[default]
Default,
/// Just run the TeX engine once.
Tex,
@ -163,12 +159,6 @@ pub enum PassSetting {
BibtexFirst,
}
impl Default for PassSetting {
fn default() -> PassSetting {
PassSetting::Default
}
}
impl FromStr for PassSetting {
type Err = &'static str;
@ -183,9 +173,10 @@ impl FromStr for PassSetting {
}
/// Different places from which the "primary input" might originate.
#[derive(Clone, Debug, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
enum PrimaryInputMode {
/// This process's standard input.
#[default]
Stdin,
/// A path on the filesystem.
@ -195,18 +186,13 @@ enum PrimaryInputMode {
Buffer(Vec<u8>),
}
impl Default for PrimaryInputMode {
fn default() -> PrimaryInputMode {
PrimaryInputMode::Stdin
}
}
/// Different places where the output files might land.
#[derive(Clone, Debug, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
enum OutputDestination {
/// The "sensible" default. Files will land in the same directory as the
/// input file, or the current working directory if the input is something
/// without a path (such as standard input).
#[default]
Default,
/// Files should land in this particular directory.
@ -217,12 +203,6 @@ enum OutputDestination {
Nowhere,
}
impl Default for OutputDestination {
fn default() -> OutputDestination {
OutputDestination::Default
}
}
/// The subset of the driver state that is captured when running a C/C++ engine.
///
/// The main purpose of this type is to implement the [`DriverHooks`] trait,
@ -778,11 +758,12 @@ impl DriverHooks for BridgeState {
}
/// Possible modes for handling shell-escape functionality
#[derive(Clone, Debug, Eq, PartialEq)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
enum ShellEscapeMode {
/// "Default" mode: shell-escape is disabled, unless it's been turned on in
/// the unstable options, in which case it will be allowed through a
/// temporary directory.
#[default]
Defaulted,
/// Shell-escape is disabled, overriding any unstable-option setting.
@ -798,12 +779,6 @@ enum ShellEscapeMode {
ExternallyManagedDir(PathBuf),
}
impl Default for ShellEscapeMode {
fn default() -> Self {
ShellEscapeMode::Defaulted
}
}
/// A custom extra pass that invokes an external tool.
///
/// This is bad for reproducibility but comes in handy.