mirror of
https://github.com/servo/servo.git
synced 2025-07-31 19:20:22 +01:00
Add a match_ignore_ascii_case! macro that does not allocate.
It should replace `match foo.to_ascii_lower().as_slice() { ...}` @Manishearth I changed map.get to map.find in the lint to work around an ICE: task 'rustc' panicked at 'couldn't find node id 0 in the AST map' Does this look OK?
This commit is contained in:
parent
540d218885
commit
2e35d4e987
6 changed files with 34 additions and 12 deletions
|
@ -104,8 +104,8 @@ fn lint_unrooted_ty(cx: &Context, ty: &ast::Ty, warning: &str) {
|
|||
// Determines if a block is in an unsafe context so that an unhelpful
|
||||
// lint can be aborted.
|
||||
fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool {
|
||||
match map.get(map.get_parent(id)) {
|
||||
ast_map::NodeImplItem(itm) => {
|
||||
match map.find(map.get_parent(id)) {
|
||||
Some(ast_map::NodeImplItem(itm)) => {
|
||||
match *itm {
|
||||
ast::MethodImplItem(ref meth) => match meth.node {
|
||||
ast::MethDecl(_, _, _, _, style, _, _, _) => match style {
|
||||
|
@ -117,7 +117,7 @@ fn unsafe_context(map: &ast_map::Map, id: ast::NodeId) -> bool {
|
|||
_ => false,
|
||||
}
|
||||
},
|
||||
ast_map::NodeItem(itm) => {
|
||||
Some(ast_map::NodeItem(itm)) => {
|
||||
match itm.node {
|
||||
ast::ItemFn(_, style, _, _, _) => match style {
|
||||
ast::UnsafeFn => true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue