Use sym::{all,any,main,not} more.
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user