diff options
| author | klensy <klensy@users.noreply.github.com> | 2024-11-05 21:19:28 +0300 |
|---|---|---|
| committer | klensy <klensy@users.noreply.github.com> | 2024-11-13 15:08:47 +0300 |
| commit | dad667b6ac5a4d0ed806d53932f5491df418bfaa (patch) | |
| tree | e9e949cf4ce469c45176b59d5a75b373302f2959 /src/bootstrap | |
| parent | 3c6841725c05c3e75a8321b114b2132eb1699fb8 (diff) | |
| download | rust-dad667b6ac5a4d0ed806d53932f5491df418bfaa.tar.gz rust-dad667b6ac5a4d0ed806d53932f5491df418bfaa.zip | |
fix tests
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/src/core/build_steps/clippy.rs | 12 | ||||
| -rw-r--r-- | src/bootstrap/src/core/config/tests.rs | 12 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/bootstrap/src/core/build_steps/clippy.rs b/src/bootstrap/src/core/build_steps/clippy.rs index ad2b349bab6..0884d86cc6d 100644 --- a/src/bootstrap/src/core/build_steps/clippy.rs +++ b/src/bootstrap/src/core/build_steps/clippy.rs @@ -66,7 +66,7 @@ fn lint_args(builder: &Builder<'_>, config: &LintConfig, ignored_rules: &[&str]) /// We need to keep the order of the given clippy lint rules before passing them. /// Since clap doesn't offer any useful interface for this purpose out of the box, /// we have to handle it manually. -fn get_clippy_rules_in_order(all_args: &[String], config: &LintConfig) -> Vec<String> { +pub fn get_clippy_rules_in_order(all_args: &[String], config: &LintConfig) -> Vec<String> { let mut result = vec![]; for (prefix, item) in @@ -86,11 +86,11 @@ fn get_clippy_rules_in_order(all_args: &[String], config: &LintConfig) -> Vec<St } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -struct LintConfig { - allow: Vec<String>, - warn: Vec<String>, - deny: Vec<String>, - forbid: Vec<String>, +pub struct LintConfig { + pub allow: Vec<String>, + pub warn: Vec<String>, + pub deny: Vec<String>, + pub forbid: Vec<String>, } impl LintConfig { diff --git a/src/bootstrap/src/core/config/tests.rs b/src/bootstrap/src/core/config/tests.rs index f911581b7ee..24f932a1724 100644 --- a/src/bootstrap/src/core/config/tests.rs +++ b/src/bootstrap/src/core/config/tests.rs @@ -9,7 +9,7 @@ use serde::Deserialize; use super::flags::Flags; use super::{ChangeIdWrapper, Config, RUSTC_IF_UNCHANGED_ALLOWED_PATHS}; -use crate::core::build_steps::clippy::get_clippy_rules_in_order; +use crate::core::build_steps::clippy::{LintConfig, get_clippy_rules_in_order}; use crate::core::build_steps::llvm; use crate::core::config::{LldMode, Target, TargetSelection, TomlConfig}; @@ -309,9 +309,10 @@ fn order_of_clippy_rules() { ]; let config = Config::parse(Flags::parse(&args)); - let actual = match &config.cmd { + let actual = match config.cmd.clone() { crate::Subcommand::Clippy { allow, deny, warn, forbid, .. } => { - get_clippy_rules_in_order(&args, &allow, &deny, &warn, &forbid) + let cfg = LintConfig { allow, deny, warn, forbid }; + get_clippy_rules_in_order(&args, &cfg) } _ => panic!("invalid subcommand"), }; @@ -332,9 +333,10 @@ fn clippy_rule_separate_prefix() { vec!["clippy".to_string(), "-A clippy:all".to_string(), "-W clippy::style".to_string()]; let config = Config::parse(Flags::parse(&args)); - let actual = match &config.cmd { + let actual = match config.cmd.clone() { crate::Subcommand::Clippy { allow, deny, warn, forbid, .. } => { - get_clippy_rules_in_order(&args, &allow, &deny, &warn, &forbid) + let cfg = LintConfig { allow, deny, warn, forbid }; + get_clippy_rules_in_order(&args, &cfg) } _ => panic!("invalid subcommand"), }; |
