Skip to content

Commit 33fd340

Browse files
committed
fix tests
1 parent ccc0c5e commit 33fd340

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
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

+4-3
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};
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

@@ -306,9 +306,10 @@ fn order_of_clippy_rules() {
306306
];
307307
let config = Config::parse(Flags::parse(&args));
308308

309-
let actual = match &config.cmd {
309+
let actual = match config.cmd.clone() {
310310
crate::Subcommand::Clippy { allow, deny, warn, forbid, .. } => {
311-
get_clippy_rules_in_order(&args, &allow, &deny, &warn, &forbid)
311+
let cfg = LintConfig { allow, deny, warn, forbid };
312+
get_clippy_rules_in_order(&args, &cfg)
312313
}
313314
_ => panic!("invalid subcommand"),
314315
};

0 commit comments

Comments
 (0)