Skip to content

Commit 8bde2c1

Browse files
committed
Minor cleanup and eliminate a bad copy
1 parent a2ec540 commit 8bde2c1

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/librustc/front/test.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,17 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
145145
}
146146

147147
fn is_test_fn(i: @ast::item) -> bool {
148-
let has_test_attr =
149-
vec::len(attr::find_attrs_by_name(i.attrs, ~"test")) > 0u;
148+
let has_test_attr = attr::find_attrs_by_name(i.attrs,
149+
~"test").is_not_empty();
150150

151151
fn has_test_signature(i: @ast::item) -> bool {
152-
match /*bad*/copy i.node {
153-
ast::item_fn(decl, _, tps, _) => {
154-
let input_cnt = vec::len(decl.inputs);
152+
match &i.node {
153+
&ast::item_fn(ref decl, _, ref tps, _) => {
155154
let no_output = match decl.output.node {
156155
ast::ty_nil => true,
157156
_ => false
158157
};
159-
let tparm_cnt = vec::len(tps);
160-
input_cnt == 0u && no_output && tparm_cnt == 0u
158+
decl.inputs.is_empty() && no_output && tps.is_empty()
161159
}
162160
_ => false
163161
}

0 commit comments

Comments
 (0)