Skip to content

Commit 344603a

Browse files
committed
dev: Make UpdateMode a copy type
1 parent 729f943 commit 344603a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

clippy_dev/src/main.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mod fmt;
88
mod new_lint;
99
mod stderr_length_check;
1010

11-
#[derive(PartialEq)]
11+
#[derive(Clone, Copy, PartialEq)]
1212
enum UpdateMode {
1313
Check,
1414
Change,
@@ -113,9 +113,9 @@ fn main() {
113113
if matches.is_present("print-only") {
114114
print_lints();
115115
} else if matches.is_present("check") {
116-
update_lints(&UpdateMode::Check);
116+
update_lints(UpdateMode::Check);
117117
} else {
118-
update_lints(&UpdateMode::Change);
118+
update_lints(UpdateMode::Change);
119119
}
120120
},
121121
("new_lint", Some(matches)) => {
@@ -124,7 +124,7 @@ fn main() {
124124
matches.value_of("name"),
125125
matches.value_of("category"),
126126
) {
127-
Ok(_) => update_lints(&UpdateMode::Change),
127+
Ok(_) => update_lints(UpdateMode::Change),
128128
Err(e) => eprintln!("Unable to create lint: {}", e),
129129
}
130130
},
@@ -161,7 +161,7 @@ fn print_lints() {
161161
}
162162

163163
#[allow(clippy::too_many_lines)]
164-
fn update_lints(update_mode: &UpdateMode) {
164+
fn update_lints(update_mode: UpdateMode) {
165165
let lint_list: Vec<Lint> = gather_all().collect();
166166

167167
let usable_lints: Vec<Lint> = Lint::usable_lints(lint_list.clone().into_iter()).collect();
@@ -175,7 +175,7 @@ fn update_lints(update_mode: &UpdateMode) {
175175
"begin lint list",
176176
"end lint list",
177177
false,
178-
update_mode == &UpdateMode::Change,
178+
update_mode == UpdateMode::Change,
179179
|| {
180180
format!(
181181
"pub const ALL_LINTS: [Lint; {}] = {:#?};",
@@ -194,7 +194,7 @@ fn update_lints(update_mode: &UpdateMode) {
194194
r#"\[There are \d+ lints included in this crate!\]\(https://rust-lang.github.io/rust-clippy/master/index.html\)"#,
195195
"",
196196
true,
197-
update_mode == &UpdateMode::Change,
197+
update_mode == UpdateMode::Change,
198198
|| {
199199
vec![
200200
format!("[There are {} lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)", lint_count)
@@ -207,7 +207,7 @@ fn update_lints(update_mode: &UpdateMode) {
207207
"<!-- begin autogenerated links to lint list -->",
208208
"<!-- end autogenerated links to lint list -->",
209209
false,
210-
update_mode == &UpdateMode::Change,
210+
update_mode == UpdateMode::Change,
211211
|| gen_changelog_lint_list(lint_list.clone()),
212212
)
213213
.changed;
@@ -217,7 +217,7 @@ fn update_lints(update_mode: &UpdateMode) {
217217
"begin deprecated lints",
218218
"end deprecated lints",
219219
false,
220-
update_mode == &UpdateMode::Change,
220+
update_mode == UpdateMode::Change,
221221
|| gen_deprecated(&lint_list),
222222
)
223223
.changed;
@@ -227,7 +227,7 @@ fn update_lints(update_mode: &UpdateMode) {
227227
"begin register lints",
228228
"end register lints",
229229
false,
230-
update_mode == &UpdateMode::Change,
230+
update_mode == UpdateMode::Change,
231231
|| gen_register_lint_list(&lint_list),
232232
)
233233
.changed;
@@ -237,7 +237,7 @@ fn update_lints(update_mode: &UpdateMode) {
237237
"begin lints modules",
238238
"end lints modules",
239239
false,
240-
update_mode == &UpdateMode::Change,
240+
update_mode == UpdateMode::Change,
241241
|| gen_modules_list(lint_list.clone()),
242242
)
243243
.changed;
@@ -248,7 +248,7 @@ fn update_lints(update_mode: &UpdateMode) {
248248
r#"store.register_group\(true, "clippy::all""#,
249249
r#"\]\);"#,
250250
false,
251-
update_mode == &UpdateMode::Change,
251+
update_mode == UpdateMode::Change,
252252
|| {
253253
// clippy::all should only include the following lint groups:
254254
let all_group_lints = usable_lints
@@ -271,13 +271,13 @@ fn update_lints(update_mode: &UpdateMode) {
271271
&format!("store.register_group\\(true, \"clippy::{}\"", lint_group),
272272
r#"\]\);"#,
273273
false,
274-
update_mode == &UpdateMode::Change,
274+
update_mode == UpdateMode::Change,
275275
|| gen_lint_group_list(lints.clone()),
276276
)
277277
.changed;
278278
}
279279

280-
if update_mode == &UpdateMode::Check && file_change {
280+
if update_mode == UpdateMode::Check && file_change {
281281
println!(
282282
"Not all lints defined properly. \
283283
Please run `cargo dev update_lints` to make sure all lints are defined properly."

0 commit comments

Comments
 (0)