Skip to content

Commit dad667b

Browse files
committed
fix tests
1 parent 3c68417 commit dad667b

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/bootstrap/src/core/build_steps/clippy.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn lint_args(builder: &Builder<'_>, config: &LintConfig, ignored_rules: &[&str])
6666
/// We need to keep the order of the given clippy lint rules before passing them.
6767
/// Since clap doesn't offer any useful interface for this purpose out of the box,
6868
/// we have to handle it manually.
69-
fn get_clippy_rules_in_order(all_args: &[String], config: &LintConfig) -> Vec<String> {
69+
pub fn get_clippy_rules_in_order(all_args: &[String], config: &LintConfig) -> Vec<String> {
7070
let mut result = vec![];
7171

7272
for (prefix, item) in
@@ -86,11 +86,11 @@ fn get_clippy_rules_in_order(all_args: &[String], config: &LintConfig) -> Vec<St
8686
}
8787

8888
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
89-
struct LintConfig {
90-
allow: Vec<String>,
91-
warn: Vec<String>,
92-
deny: Vec<String>,
93-
forbid: Vec<String>,
89+
pub struct LintConfig {
90+
pub allow: Vec<String>,
91+
pub warn: Vec<String>,
92+
pub deny: Vec<String>,
93+
pub forbid: Vec<String>,
9494
}
9595

9696
impl LintConfig {

src/bootstrap/src/core/config/tests.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use serde::Deserialize;
99

1010
use super::flags::Flags;
1111
use super::{ChangeIdWrapper, Config, RUSTC_IF_UNCHANGED_ALLOWED_PATHS};
12-
use crate::core::build_steps::clippy::get_clippy_rules_in_order;
12+
use crate::core::build_steps::clippy::{LintConfig, get_clippy_rules_in_order};
1313
use crate::core::build_steps::llvm;
1414
use crate::core::config::{LldMode, Target, TargetSelection, TomlConfig};
1515

@@ -309,9 +309,10 @@ fn order_of_clippy_rules() {
309309
];
310310
let config = Config::parse(Flags::parse(&args));
311311

312-
let actual = match &config.cmd {
312+
let actual = match config.cmd.clone() {
313313
crate::Subcommand::Clippy { allow, deny, warn, forbid, .. } => {
314-
get_clippy_rules_in_order(&args, &allow, &deny, &warn, &forbid)
314+
let cfg = LintConfig { allow, deny, warn, forbid };
315+
get_clippy_rules_in_order(&args, &cfg)
315316
}
316317
_ => panic!("invalid subcommand"),
317318
};
@@ -332,9 +333,10 @@ fn clippy_rule_separate_prefix() {
332333
vec!["clippy".to_string(), "-A clippy:all".to_string(), "-W clippy::style".to_string()];
333334
let config = Config::parse(Flags::parse(&args));
334335

335-
let actual = match &config.cmd {
336+
let actual = match config.cmd.clone() {
336337
crate::Subcommand::Clippy { allow, deny, warn, forbid, .. } => {
337-
get_clippy_rules_in_order(&args, &allow, &deny, &warn, &forbid)
338+
let cfg = LintConfig { allow, deny, warn, forbid };
339+
get_clippy_rules_in_order(&args, &cfg)
338340
}
339341
_ => panic!("invalid subcommand"),
340342
};

0 commit comments

Comments
 (0)