Skip to content

Commit 9e67b3e

Browse files
committed
remove trailing code
1 parent 1c92ba8 commit 9e67b3e

File tree

5 files changed

+3
-72
lines changed

5 files changed

+3
-72
lines changed

crates/ink/ir/src/ir/event/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ use crate::{
2929
utils::extract_cfg_attributes,
3030
};
3131

32-
pub use signature_topic::{
33-
SignatureTopic,
34-
SignatureTopicArg,
35-
};
32+
pub use signature_topic::SignatureTopicArg;
3633

3734
/// A checked ink! event with its configuration.
3835
#[derive(Debug, PartialEq, Eq)]

crates/ink/ir/src/ir/event/signature_topic.rs

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,9 @@
1313
// limitations under the License.
1414

1515
use impl_serde::serialize as serde_hex;
16-
use proc_macro2::{
17-
Span,
18-
TokenStream as TokenStream2,
19-
};
20-
use quote::ToTokens;
2116
use syn::spanned::Spanned;
2217

23-
use crate::{
24-
ast,
25-
error::ExtError,
26-
utils::extract_cfg_attributes,
27-
};
18+
use crate::ast;
2819

2920
/// The signature topic argument of an event variant.
3021
///
@@ -132,57 +123,3 @@ impl TryFrom<&syn::MetaNameValue> for SignatureTopicArg {
132123
}
133124
}
134125
}
135-
136-
/// The signature topic argument of an event variant.
137-
///
138-
/// Used as part of `ink::signature_topic` macro.
139-
///
140-
/// Calculated with `blake2b("Event(field1_type,field2_type)")`.
141-
#[derive(Debug, PartialEq, Eq)]
142-
pub struct SignatureTopic {
143-
item: syn::ItemStruct,
144-
arg: Option<SignatureTopicArg>,
145-
}
146-
147-
impl SignatureTopic {
148-
pub fn new(config: TokenStream2, item: TokenStream2) -> Result<Self, syn::Error> {
149-
let item = syn::parse2::<syn::ItemStruct>(item.clone()).map_err(|err| {
150-
err.into_combine(format_err_spanned!(
151-
item,
152-
"event definition must be a `struct`",
153-
))
154-
})?;
155-
let parsed_config = syn::parse2::<crate::ast::AttributeArgs>(config)?;
156-
let arg = Option::<SignatureTopicArg>::try_from(parsed_config)?;
157-
158-
for attr in &item.attrs {
159-
if attr
160-
.path()
161-
.to_token_stream()
162-
.to_string()
163-
.contains("signature_topic")
164-
{
165-
return Err(format_err_spanned!(
166-
attr,
167-
"only one `ink::signature_topic` is allowed",
168-
));
169-
}
170-
}
171-
Ok(Self { item, arg })
172-
}
173-
174-
/// Returns the event definition .
175-
pub fn item(&self) -> &syn::ItemStruct {
176-
&self.item
177-
}
178-
179-
/// Return a signature topic, if required.
180-
pub fn signature_topic(&self) -> Option<[u8; 32]> {
181-
self.arg.map(|a| a.signature_topic())
182-
}
183-
184-
/// Returns a list of `cfg` attributes if any.
185-
pub fn get_cfg_attrs(&self, span: Span) -> Vec<TokenStream2> {
186-
extract_cfg_attributes(&self.item.attrs, span)
187-
}
188-
}

crates/ink/ir/src/ir/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ pub use self::{
7272
contract::Contract,
7373
event::{
7474
Event,
75-
SignatureTopic,
7675
SignatureTopicArg,
7776
},
7877
ink_test::InkTest,

crates/ink/ir/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ pub use self::{
7777
Receiver,
7878
Selector,
7979
SelectorMacro,
80-
SignatureTopic,
8180
SignatureTopicArg,
8281
Storage,
8382
StorageItem,

crates/ink/macro/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,8 +1344,7 @@ synstructure::decl_derive!(
13441344
[Event, attributes(ink)] =>
13451345
/// Derives an implementation of the [`ink::Event`] trait for the given `struct`.
13461346
///
1347-
/// **Note** [`ink::Event`] requires [`scale::Encode`] implementation,
1348-
/// it is up to the user to provide that: usually via the derive and `#[ink::signature_topic]` macros.
1347+
/// **Note** [`ink::Event`] requires [`scale::Encode`] implementation.
13491348
///
13501349
/// Usually this is used in conjunction with the [`EventMetadata`] derive.
13511350
///

0 commit comments

Comments
 (0)