Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Commit a0fa2d0

Browse files
committed
Update to Rust 1.15.0-nightly (0ed951993 2016-11-14)
1 parent 87250d1 commit a0fa2d0

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "heapsize_derive"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
authors = ["The Servo Project Developers"]
55
description = "Automatically generating infrastructure for measuring the total runtime size of an object on the heap"
66
license = "MPL-2.0"

derive/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,16 @@ fn expand_string(input: &str) -> String {
2020

2121
let style = synstructure::BindStyle::Ref.into();
2222
let match_body = synstructure::each_field(&mut type_, &style, |binding| {
23-
let mut ignore = false;
24-
binding.field.attrs.retain(|attr| match attr.value {
23+
let ignore = binding.field.attrs.iter().any(|attr| match attr.value {
2524
syn::MetaItem::Word(ref ident) |
2625
syn::MetaItem::List(ref ident, _) if ident == "ignore_heap_size_of" => {
2726
panic!("#[ignore_heap_size_of] should have an explanation, \
2827
e.g. #[ignore_heap_size_of = \"because reasons\"]");
2928
}
3029
syn::MetaItem::NameValue(ref ident, _) if ident == "ignore_heap_size_of" => {
31-
ignore = true;
32-
false // Don’t retain
30+
true
3331
}
34-
_ => true // Do retain everything else
32+
_ => false,
3533
});
3634
if ignore {
3735
None
@@ -66,8 +64,6 @@ fn expand_string(input: &str) -> String {
6664
}
6765

6866
let tokens = quote! {
69-
#type_
70-
7167
impl #impl_generics ::heapsize::HeapSizeOf for #name #ty_generics #where_clause {
7268
#[inline]
7369
#[allow(unused_variables, unused_mut, unreachable_code)]
@@ -96,7 +92,7 @@ fn test_struct() {
9692
$e, expanded)
9793
}
9894
}
99-
match_count!("struct Foo<T> { bar: Bar, baz: T, z: Arc<T> }", 1);
95+
match_count!("struct Foo<T> { bar: Bar, baz: T, z: Arc<T> }", 0);
10096
match_count!("ignore_heap_size_of", 0);
10197
match_count!("impl<T> ::heapsize::HeapSizeOf for Foo<T> where T: ::heapsize::HeapSizeOf {", 1);
10298
match_count!("sum += ::heapsize::HeapSizeOf::heap_size_of_children(", 2);

0 commit comments

Comments
 (0)