Skip to content

Commit

Permalink
remove duplicate check for IDE (#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyan-dfinity committed Oct 23, 2023
1 parent 9ab2733 commit 2308128
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions rust/candid/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "candid"
version = "0.9.10"
version = "0.9.11"
edition = "2021"
authors = ["DFINITY Team"]
description = "Candid is an interface description language (IDL) for interacting with canisters running on the Internet Computer."
Expand All @@ -20,7 +20,7 @@ lalrpop = { version = "0.20.0", optional = true }

[dependencies]
byteorder = "1.4.3"
candid_derive = { path = "../candid_derive", version = "=0.6.3" }
candid_derive = { path = "../candid_derive", version = "=0.6.4" }
codespan-reporting = "0.11"
crc32fast = "1.3.0"
data-encoding = "2.4.0"
Expand Down
2 changes: 1 addition & 1 deletion rust/candid_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "candid_derive"
version = "0.6.3"
version = "0.6.4"
edition = "2021"
authors = ["DFINITY Team"]
description = "Macros implementation of #[derive(CandidType)] for the Candid."
Expand Down
13 changes: 1 addition & 12 deletions rust/candid_derive/src/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ pub(crate) fn candid_method(attrs: Vec<Meta>, fun: ItemFn) -> Result<TokenStream
match (rets.len(), rets.get(0).map(|x| x.as_str())) {
(0, None) | (1, Some("Self")) => {
if let Some(init) = INIT.lock().unwrap().as_mut() {
if init.is_some() {
return Err(Error::new_spanned(&sig.ident, "duplicate init method"));
};
*init = Some(args);
}
}
Expand All @@ -67,15 +64,7 @@ pub(crate) fn candid_method(attrs: Vec<Meta>, fun: ItemFn) -> Result<TokenStream
}
}
} else if let Some(map) = METHODS.lock().unwrap().as_mut() {
if map
.insert(name.clone(), Method { args, rets, modes })
.is_some()
{
return Err(Error::new_spanned(
&sig.ident,
format!("duplicate method name {name}"),
));
}
map.insert(name.clone(), Method { args, rets, modes });
}
Ok(quote! { #fun })
}
Expand Down

0 comments on commit 2308128

Please sign in to comment.