fix tests
This commit is contained in:
parent
3c6841725c
commit
dad667b6ac
2 changed files with 13 additions and 11 deletions
|
@ -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 {
|
||||
|
|
|
@ -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"),
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue