Skip to content

Commit 887e8e1

Browse files
committed
Make the latest Clippy happy
1 parent 7ee80ae commit 887e8e1

6 files changed

Lines changed: 19 additions & 65 deletions

File tree

crates/bridge_core/src/lib.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -714,11 +714,12 @@ pub struct SecuritySettings {
714714

715715
/// Different high-level security stances that can be adopted when creating
716716
/// [`SecuritySettings`].
717-
#[derive(Clone, Debug)]
717+
#[derive(Clone, Debug, Default)]
718718
pub enum SecurityStance {
719719
/// Ensure that all known-insecure features are disabled.
720720
///
721721
/// Use this stance if you are processing untrusted input.
722+
#[default]
722723
DisableInsecures,
723724

724725
/// Request to allow the use of known-insecure features.
@@ -730,13 +731,6 @@ pub enum SecurityStance {
730731
MaybeAllowInsecures,
731732
}
732733

733-
impl Default for SecurityStance {
734-
fn default() -> Self {
735-
// Obvi, the default is secure!!!
736-
SecurityStance::DisableInsecures
737-
}
738-
}
739-
740734
impl SecuritySettings {
741735
/// Create a new security configuration.
742736
///

crates/dep_support/src/lib.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,16 @@ use std::{
1414
};
1515

1616
/// Supported depedency-finding backends.
17-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
17+
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
1818
pub enum Backend {
1919
/// pkg-config
20+
#[default]
2021
PkgConfig,
2122

2223
/// vcpkg
2324
Vcpkg,
2425
}
2526

26-
impl Default for Backend {
27-
fn default() -> Self {
28-
Backend::PkgConfig
29-
}
30-
}
31-
3227
/// Dep-finding configuration.
3328
#[derive(Clone, Debug, Eq, PartialEq)]
3429
pub struct Configuration {

crates/engine_spx2html/src/assets.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ impl AssetSpecification {
322322

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

crates/engine_spx2html/src/lib.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,14 @@ pub struct Spx2HtmlEngine {
3838
do_not_emit_assets: bool,
3939
}
4040

41-
#[derive(Debug)]
41+
#[derive(Debug, Default)]
4242
enum OutputState {
43+
#[default]
4344
Undefined,
4445
NoOutput,
4546
Path(PathBuf),
4647
}
4748

48-
impl Default for OutputState {
49-
fn default() -> Self {
50-
OutputState::Undefined
51-
}
52-
}
53-
5449
impl Spx2HtmlEngine {
5550
/// Emit an asset specification file and not actual assets.
5651
///

crates/status_base/src/lib.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ pub enum MessageKind {
3232
/// A setting regarding which messages to display.
3333
#[repr(usize)]
3434
#[non_exhaustive]
35-
#[derive(Clone, Copy, Eq, Debug)]
35+
#[derive(Clone, Copy, Debug, Default, Eq)]
3636
pub enum ChatterLevel {
3737
/// Suppress all informational output.
3838
Minimal = 0,
3939

4040
/// Normal output levels.
41+
#[default]
4142
Normal,
4243
}
4344

@@ -52,12 +53,6 @@ impl ChatterLevel {
5253
}
5354
}
5455

55-
impl Default for ChatterLevel {
56-
fn default() -> Self {
57-
ChatterLevel::Normal
58-
}
59-
}
60-
6156
impl FromStr for ChatterLevel {
6257
type Err = &'static str;
6358

src/driver.rs

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl FileSummary {
116116
}
117117

118118
/// The different types of output files that tectonic knows how to produce.
119-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
119+
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
120120
pub enum OutputFormat {
121121
/// A '.aux' file.
122122
Aux,
@@ -125,6 +125,7 @@ pub enum OutputFormat {
125125
/// An extended DVI file.
126126
Xdv,
127127
/// A '.pdf' file.
128+
#[default]
128129
Pdf,
129130
/// A '.fmt' file, for initializing the TeX engine.
130131
Format,
@@ -145,30 +146,19 @@ impl FromStr for OutputFormat {
145146
}
146147
}
147148

148-
impl Default for OutputFormat {
149-
fn default() -> OutputFormat {
150-
OutputFormat::Pdf
151-
}
152-
}
153-
154149
/// The different types of "passes" that [`ProcessingSession`] knows how to run. See
155150
/// [`ProcessingSession::run`] for more details.
156-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
151+
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
157152
pub enum PassSetting {
158153
/// The default pass, which repeatedly runs TeX and BibTeX until it doesn't need to any more.
154+
#[default]
159155
Default,
160156
/// Just run the TeX engine once.
161157
Tex,
162158
/// Like the default pass, but runs BibTeX once first, before doing anything else.
163159
BibtexFirst,
164160
}
165161

166-
impl Default for PassSetting {
167-
fn default() -> PassSetting {
168-
PassSetting::Default
169-
}
170-
}
171-
172162
impl FromStr for PassSetting {
173163
type Err = &'static str;
174164

@@ -183,9 +173,10 @@ impl FromStr for PassSetting {
183173
}
184174

185175
/// Different places from which the "primary input" might originate.
186-
#[derive(Clone, Debug, Eq, PartialEq)]
176+
#[derive(Clone, Debug, Default, Eq, PartialEq)]
187177
enum PrimaryInputMode {
188178
/// This process's standard input.
179+
#[default]
189180
Stdin,
190181

191182
/// A path on the filesystem.
@@ -195,18 +186,13 @@ enum PrimaryInputMode {
195186
Buffer(Vec<u8>),
196187
}
197188

198-
impl Default for PrimaryInputMode {
199-
fn default() -> PrimaryInputMode {
200-
PrimaryInputMode::Stdin
201-
}
202-
}
203-
204189
/// Different places where the output files might land.
205-
#[derive(Clone, Debug, Eq, PartialEq)]
190+
#[derive(Clone, Debug, Default, Eq, PartialEq)]
206191
enum OutputDestination {
207192
/// The "sensible" default. Files will land in the same directory as the
208193
/// input file, or the current working directory if the input is something
209194
/// without a path (such as standard input).
195+
#[default]
210196
Default,
211197

212198
/// Files should land in this particular directory.
@@ -217,12 +203,6 @@ enum OutputDestination {
217203
Nowhere,
218204
}
219205

220-
impl Default for OutputDestination {
221-
fn default() -> OutputDestination {
222-
OutputDestination::Default
223-
}
224-
}
225-
226206
/// The subset of the driver state that is captured when running a C/C++ engine.
227207
///
228208
/// The main purpose of this type is to implement the [`DriverHooks`] trait,
@@ -778,11 +758,12 @@ impl DriverHooks for BridgeState {
778758
}
779759

780760
/// Possible modes for handling shell-escape functionality
781-
#[derive(Clone, Debug, Eq, PartialEq)]
761+
#[derive(Clone, Debug, Default, Eq, PartialEq)]
782762
enum ShellEscapeMode {
783763
/// "Default" mode: shell-escape is disabled, unless it's been turned on in
784764
/// the unstable options, in which case it will be allowed through a
785765
/// temporary directory.
766+
#[default]
786767
Defaulted,
787768

788769
/// Shell-escape is disabled, overriding any unstable-option setting.
@@ -798,12 +779,6 @@ enum ShellEscapeMode {
798779
ExternallyManagedDir(PathBuf),
799780
}
800781

801-
impl Default for ShellEscapeMode {
802-
fn default() -> Self {
803-
ShellEscapeMode::Defaulted
804-
}
805-
}
806-
807782
/// A custom extra pass that invokes an external tool.
808783
///
809784
/// This is bad for reproducibility but comes in handy.

0 commit comments

Comments
 (0)