Skip to content

Commit

Permalink
Merge pull request #237 from bitfinity-network/maxim/fix_ra_errors
Browse files Browse the repository at this point in the history
Fix errors when using rust-analyzer with canister method attributes
  • Loading branch information
ufoscout authored Dec 2, 2024
2 parents 1185e8b + 4b789dc commit df53171
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion ic-auction/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ pub struct Controller<'a> {
state: &'a mut AuctionState,
}

impl<'a> Authorized<Controller<'a>> {
impl Authorized<Controller<'_>> {
pub fn set_min_cycles(&mut self, min_cycles: Cycles) {
self.auth.state.min_cycles = min_cycles;
}
Expand Down
12 changes: 1 addition & 11 deletions ic-canister/ic-canister-macros/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,7 @@ fn store_candid_definitions(modes: &str, sig: &Signature) -> Result<(), syn::Err
}

if modes == "init" {
match &mut *INIT.lock().unwrap() {
Some(_) => return Err(Error::new_spanned(&sig.ident, "duplicate init method")),
ret @ None => *ret = Some(args),
}
*INIT.lock().unwrap() = Some(args);
return Ok(());
}

Expand All @@ -530,13 +527,6 @@ fn store_candid_definitions(modes: &str, sig: &Signature) -> Result<(), syn::Err
// Insert method
let mut map = METHODS.lock().unwrap();

if map.contains_key(&name) {
return Err(Error::new_spanned(
&name,
format!("duplicate method name {name}"),
));
}

let method = Method {
args,
rets,
Expand Down
2 changes: 1 addition & 1 deletion ic-log/src/formatter/humantime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl fmt::Debug for Rfc3339Timestamp {
/// A `Debug` wrapper for `Timestamp` that uses the `Display` implementation.
struct TimestampValue<'a>(&'a Rfc3339Timestamp);

impl<'a> fmt::Debug for TimestampValue<'a> {
impl fmt::Debug for TimestampValue<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(&self.0, f)
}
Expand Down
4 changes: 2 additions & 2 deletions ic-log/src/formatter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ struct DefaultFormat<'a> {
suffix: &'a str,
}

impl<'a> DefaultFormat<'a> {
impl DefaultFormat<'_> {
fn write(mut self, record: &Record) -> io::Result<()> {
self.write_timestamp()?;
self.write_level(record)?;
Expand Down Expand Up @@ -250,7 +250,7 @@ impl<'a> DefaultFormat<'a> {
indent_count: usize,
}

impl<'a, 'b> Write for IndentWrapper<'a, 'b> {
impl Write for IndentWrapper<'_, '_> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
let mut first = true;
for chunk in buf.split(|&x| x == b'\n') {
Expand Down
4 changes: 2 additions & 2 deletions ic-stable-structures/src/structure/stable_storage/multimap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ where
// -----------------------------------------------------------------------------
// - Range Iterator impl -
// -----------------------------------------------------------------------------
impl<'a, K1, K2, V, M> Iterator for StableMultimapRangeIter<'a, K1, K2, V, M>
impl<K1, K2, V, M> Iterator for StableMultimapRangeIter<'_, K1, K2, V, M>
where
K1: Storable + Ord + Clone,
K2: Storable + Ord + Clone,
Expand Down Expand Up @@ -165,7 +165,7 @@ where
}
}

impl<'a, K1, K2, V, M> Iterator for StableMultimapIter<'a, K1, K2, V, M>
impl<K1, K2, V, M> Iterator for StableMultimapIter<'_, K1, K2, V, M>
where
K1: Storable + Ord + Clone,
K2: Storable + Ord + Clone,
Expand Down

0 comments on commit df53171

Please sign in to comment.