aboutsummaryrefslogtreecommitdiffstats
path: root/components/plugins/lints.rs
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2014-12-21 11:17:53 +0000
committerSimon Sapin <simon.sapin@exyr.org>2014-12-29 16:19:10 +0100
commit2e35d4e9879089759a0afe865cb6fb7796084938 (patch)
tree4486c7c01673916b0c48b21c5226afb1b67071f6 /components/plugins/lints.rs
parent540d21888558751a5fae0b71011306068a58bc6f (diff)
downloadservo-2e35d4e9879089759a0afe865cb6fb7796084938.tar.gz
servo-2e35d4e9879089759a0afe865cb6fb7796084938.zip
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?
Diffstat (limited to 'components/plugins/lints.rs')
-rw-r--r--components/plugins/lints.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/components/plugins/lints.rs b/components/plugins/lints.rs
index a170cb6a4a1..3cb4cb91e1f 100644
--- a/components/plugins/lints.rs
+++ b/components/plugins/lints.rs
@@ -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,