paritytech / paritytech/parity-scale-codec

Clippy warning emitted in `DecodeWithMemTracking`.

Open
#705 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
287
Forks
103
Avg merge
6d 13h
Merged PRs (30d)
1

Description

This code will trigger a clippy warning:

use parity_scale_codec::{Decode, DecodeWithMemTracking, Encode};

#[derive(Decode, DecodeWithMemTracking, Encode)]
pub struct InnerBound<Balance: Decode>(Balance);
warning: bound is defined in more than one place
 --> src/lib.rs:4:23
  |
4 | pub struct InnerBound<Balance: Decode>(Balance);
  |                       ^^^^^^^          ^^^^^^^
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations
  = note: `#[warn(clippy::multiple_bound_locations)]` on by default

The warning will disappear if we remove DecodeWithMemTracking derivation.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the warning from the example in src/lib.rs with Clippy, then trace the DecodeWithMemTracking derive involved in the example. The work is done when the shown generic declaration no longer triggers multiple_bound_locations while retaining both derives, with a regression check for the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.