mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-10 14:02:57 +00:00
libsyntax: change attr:get_attr_name to take a ref
This commit is contained in:
parent
bc62bd3782
commit
1a5b8e4aba
@ -111,7 +111,7 @@ fn fold_mod(cx: @mut TestCtxt,
|
||||
fn nomain(cx: @mut TestCtxt, item: @ast::item) -> @ast::item {
|
||||
if !*cx.sess.building_library {
|
||||
@ast::item{attrs: item.attrs.filtered(|attr| {
|
||||
attr::get_attr_name(*attr) != ~"main"
|
||||
attr::get_attr_name(attr) != ~"main"
|
||||
}),.. copy *item}
|
||||
} else { item }
|
||||
}
|
||||
|
@ -1097,7 +1097,7 @@ fn synthesize_crate_attrs(ecx: @encode_ctxt, crate: &crate) -> ~[attribute] {
|
||||
let mut found_link_attr = false;
|
||||
for crate.node.attrs.each |attr| {
|
||||
attrs.push(
|
||||
if attr::get_attr_name(*attr) != ~"link" {
|
||||
if attr::get_attr_name(attr) != ~"link" {
|
||||
/*bad*/copy *attr
|
||||
} else {
|
||||
match /*bad*/copy attr.node.value.node {
|
||||
|
@ -90,7 +90,7 @@ pub fn desugar_doc_attr(attr: &ast::attribute) -> ast::attribute {
|
||||
|
||||
/* Accessors */
|
||||
|
||||
pub fn get_attr_name(attr: ast::attribute) -> ~str {
|
||||
pub fn get_attr_name(attr: &ast::attribute) -> ~str {
|
||||
get_meta_item_name(@attr.node.value)
|
||||
}
|
||||
|
||||
@ -146,14 +146,13 @@ pub fn get_name_value_str_pair(item: @ast::meta_item)
|
||||
/// Search a list of attributes and return only those with a specific name
|
||||
pub fn find_attrs_by_name(attrs: &[ast::attribute], name: &str) ->
|
||||
~[ast::attribute] {
|
||||
let filter: &fn(a: &ast::attribute) -> Option<ast::attribute> = |a| {
|
||||
if name == get_attr_name(*a) {
|
||||
option::Some(*a)
|
||||
do vec::filter_mapped(attrs) |a| {
|
||||
if name == get_attr_name(a) {
|
||||
Some(*a)
|
||||
} else {
|
||||
option::None
|
||||
None
|
||||
}
|
||||
};
|
||||
return vec::filter_mapped(attrs, filter);
|
||||
}
|
||||
}
|
||||
|
||||
/// Search a list of meta items and return only those with a specific name
|
||||
|
@ -114,7 +114,7 @@ pub fn expand_auto_encode(
|
||||
in_items: ~[@ast::item]
|
||||
) -> ~[@ast::item] {
|
||||
fn is_auto_encode(a: &ast::attribute) -> bool {
|
||||
attr::get_attr_name(*a) == ~"auto_encode"
|
||||
attr::get_attr_name(a) == ~"auto_encode"
|
||||
}
|
||||
|
||||
fn filter_attrs(item: @ast::item) -> @ast::item {
|
||||
@ -169,7 +169,7 @@ pub fn expand_auto_decode(
|
||||
in_items: ~[@ast::item]
|
||||
) -> ~[@ast::item] {
|
||||
fn is_auto_decode(a: &ast::attribute) -> bool {
|
||||
attr::get_attr_name(*a) == ~"auto_decode"
|
||||
attr::get_attr_name(a) == ~"auto_decode"
|
||||
}
|
||||
|
||||
fn filter_attrs(item: @ast::item) -> @ast::item {
|
||||
|
Loading…
Reference in New Issue
Block a user