Use sym::{all,any,main,not} more.

This commit is contained in:
Nicholas Nethercote
2019-09-05 06:43:03 +10:00
parent 2b8116dced
commit c36d7d4834
2 changed files with 5 additions and 5 deletions

View File

@@ -81,10 +81,10 @@ impl Cfg {
}, },
MetaItemKind::List(ref items) => { MetaItemKind::List(ref items) => {
let mut sub_cfgs = items.iter().map(Cfg::parse_nested); let mut sub_cfgs = items.iter().map(Cfg::parse_nested);
match &*name.as_str() { match name {
"all" => sub_cfgs.fold(Ok(Cfg::True), |x, y| Ok(x? & y?)), sym::all => sub_cfgs.fold(Ok(Cfg::True), |x, y| Ok(x? & y?)),
"any" => sub_cfgs.fold(Ok(Cfg::False), |x, y| Ok(x? | y?)), sym::any => sub_cfgs.fold(Ok(Cfg::False), |x, y| Ok(x? | y?)),
"not" => if sub_cfgs.len() == 1 { sym::not => if sub_cfgs.len() == 1 {
Ok(!sub_cfgs.next().unwrap()?) Ok(!sub_cfgs.next().unwrap()?)
} else { } else {
Err(InvalidCfgError { Err(InvalidCfgError {

View File

@@ -407,7 +407,7 @@ pub fn make_test(s: &str,
Ok(Some(item)) => { Ok(Some(item)) => {
if !found_main { if !found_main {
if let ast::ItemKind::Fn(..) = item.node { if let ast::ItemKind::Fn(..) = item.node {
if item.ident.as_str() == "main" { if item.ident.name == sym::main {
found_main = true; found_main = true;
} }
} }