Skip to content

docs(erc20): improve docs for ERC20Burnable (#27)

Sign in for the full log view
GitHub Actions / clippy failed Apr 9, 2024 in 1s

reviewdog [clippy] report

reported by reviewdog 🐶

Findings (6)

contracts/src/erc20/mod.rs|341 col 20| warning: redundant else block
--> contracts/src/erc20/mod.rs:341:20
|
341 | } else {
| ^
342 | | // Overflow not possible:
343 | | // value <= from_balance <= total_supply.
344 | | self.balances.setter(from).set(from_balance - value);
345 | | }
| |
___________^
|
= help: remove the else block and move the contents out
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_else
note: the lint level is defined here
--> contracts/src/lib.rs:3:22
|
3 | #![warn(clippy::all, clippy::pedantic)]
| ^^^^^^^^^^^^^^^^
= note: #[warn(clippy::redundant_else)] implied by #[warn(clippy::pedantic)]
contracts/src/erc20/extensions/burnable.rs|10 col 7| warning: item in documentation is missing backticks
--> contracts/src/erc20/extensions/burnable.rs:10:7
|
10 | /// * alloy_primitives::{Address, U256}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
10 | /// * alloy_primitives::{Address, U256}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
contracts/src/erc20/extensions/burnable.rs|11 col 7| warning: item in documentation is missing backticks
--> contracts/src/erc20/extensions/burnable.rs:11:7
|
11 | /// * contracts::erc20::{Error, ERC20}
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
11 | /// * contracts::erc20::{Error, ERC20}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~
contracts/src/erc20/extensions/burnable.rs|12 col 7| warning: item in documentation is missing backticks
--> contracts/src/erc20/extensions/burnable.rs:12:7
|
12 | /// * stylus_sdk::msg
| ^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
|
12 | /// * stylus_sdk::msg
| ~~~~~~~~~~~~~~~~~
contracts/src/erc20/extensions/burnable.rs|13 col 14| warning: item name ends with its containing module's name
--> contracts/src/erc20/extensions/burnable.rs:13:14
|
13 | macro_rules! impl_erc20_burnable {
| ^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
= note: #[warn(clippy::module_name_repetitions)] implied by #[warn(clippy::pedantic)]
contracts/src/erc20/mod.rs|317 col 5| warning: docs for function which may panic missing # Panics section
--> contracts/src/erc20/mod.rs:317:5
|
317 | / pub fn _update(
318 | | &mut self,
319 | | from: Address,
320 | | to: Address,
321 | | value: U256,
322 | | ) -> Result<(), Error> {
| |
______^
|
note: first possible panic found here
--> contracts/src/erc20/mod.rs:326:32
|
326 | let total_supply = self
| ________________________________^
327 | | .total_supply()
328 | | .checked_add(value)
329 | | .expect("Should not exceed U256::MAX for _total_supply");
| |____________________________________________________________________________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
= note: #[warn(clippy::missing_panics_doc)] implied by #[warn(clippy::pedantic)]

Filtered Findings (5)

contracts/src/erc20/mod.rs|3 col 30| warning: item in documentation is missing backticks
--> contracts/src/erc20/mod.rs:3:30
|
3 | //! We have followed general OpenZeppelin Contracts guidelines: functions
| ^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
= note: #[warn(clippy::doc_markdown)] implied by #[warn(clippy::pedantic)]
help: try
|
3 | //! We have followed general OpenZeppelin Contracts guidelines: functions
| ~~~~~~~~~~~~~~
contracts/src/erc20/extensions/metadata.rs|9 col 1| warning: field marked as public but also inferred as unused because it's prefixed with _
--> contracts/src/erc20/extensions/metadata.rs:9:1
|
9 | / sol_storage! {
10 | | /// Optional metadata of the ERC-20 standard.
11 | | pub struct Metadata {
12 | | /// Token name.
... |
22 | | }
23 | | }
| |^
|
= help: consider removing the underscore, or making the field private
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#pub_underscore_fields
= note: #[warn(clippy::pub_underscore_fields)] implied by #[warn(clippy::pedantic)]
= note: this warning originates in the macro sol_storage (in Nightly builds, run with -Z macro-backtrace for more info)
contracts/src/erc20/mod.rs|87 col 1| warning: field marked as public but also inferred as unused because it's prefixed with _
--> contracts/src/erc20/mod.rs:87:1
|
87 | / sol_storage! {
88 | | /// State of an ERC20 token.
89 | | pub struct ERC20 {
90 | | /// Maps users to balances.
... |
96 | | }
97 | | }
| |
^
|
= help: consider removing the underscore, or making the field private
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#pub_underscore_fields
= note: this warning originates in the macro sol_storage (in Nightly builds, run with -Z macro-backtrace for more info)
contracts/src/erc20/mod.rs|17 col 1| warning: missing documentation for a struct field
--> contracts/src/erc20/mod.rs:17:1
|
17 | / sol! {
18 | | /// Emitted when value tokens are moved from one account (from) to
19 | | /// another (to).
20 | | ///
... |
25 | | event Approval(address indexed owner, address indexed spender, uint256 value);
26 | | }
| |^
|
note: the lint level is defined here
--> contracts/src/lib.rs:2:9
|
2 | #![warn(missing_docs, unreachable_pub, rust_2021_compatibility)]
| ^^^^^^^^^^^^
= note: this warning originates in the macro sol (in Nightly builds, run with -Z macro-backtrace for more info)
contracts/src/erc20/mod.rs|28 col 1| warning: missing documentation for a struct field
--> contracts/src/erc20/mod.rs:28:1
|
28 | / sol! {
29 | | /// Indicates an error related to the current balance of sender. Used
30 | | /// in transfers.
31 | | ///
... |
64 | |
65 | | }
| |
^
|
= note: this warning originates in the macro sol (in Nightly builds, run with -Z macro-backtrace for more info)

Annotations

Check warning on line 341 in contracts/src/erc20/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

[clippy] contracts/src/erc20/mod.rs#L341

warning: redundant else block
   --> contracts/src/erc20/mod.rs:341:20
    |
341 |               } else {
    |  ____________________^
342 | |                 // Overflow not possible:
343 | |                 // value <= from_balance <= _total_supply.
344 | |                 self._balances.setter(from).set(from_balance - value);
345 | |             }
    | |_____________^
    |
    = help: remove the `else` block and move the contents out
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_else
note: the lint level is defined here
   --> contracts/src/lib.rs:3:22
    |
3   | #![warn(clippy::all, clippy::pedantic)]
    |                      ^^^^^^^^^^^^^^^^
    = note: `#[warn(clippy::redundant_else)]` implied by `#[warn(clippy::pedantic)]`
Raw output
contracts/src/erc20/mod.rs:341:20:w:warning: redundant else block
   --> contracts/src/erc20/mod.rs:341:20
    |
341 |               } else {
    |  ____________________^
342 | |                 // Overflow not possible:
343 | |                 // value <= from_balance <= _total_supply.
344 | |                 self._balances.setter(from).set(from_balance - value);
345 | |             }
    | |_____________^
    |
    = help: remove the `else` block and move the contents out
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_else
note: the lint level is defined here
   --> contracts/src/lib.rs:3:22
    |
3   | #![warn(clippy::all, clippy::pedantic)]
    |                      ^^^^^^^^^^^^^^^^
    = note: `#[warn(clippy::redundant_else)]` implied by `#[warn(clippy::pedantic)]`


__END__

Check warning on line 10 in contracts/src/erc20/extensions/burnable.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

[clippy] contracts/src/erc20/extensions/burnable.rs#L10

warning: item in documentation is missing backticks
  --> contracts/src/erc20/extensions/burnable.rs:10:7
   |
10 | /// * alloy_primitives::{Address, U256}
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
   |
10 | /// * `alloy_primitives::{Address`, U256}
   |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Raw output
contracts/src/erc20/extensions/burnable.rs:10:7:w:warning: item in documentation is missing backticks
  --> contracts/src/erc20/extensions/burnable.rs:10:7
   |
10 | /// * alloy_primitives::{Address, U256}
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
   |
10 | /// * `alloy_primitives::{Address`, U256}
   |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~


__END__

Check warning on line 11 in contracts/src/erc20/extensions/burnable.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

[clippy] contracts/src/erc20/extensions/burnable.rs#L11

warning: item in documentation is missing backticks
  --> contracts/src/erc20/extensions/burnable.rs:11:7
   |
11 | /// * contracts::erc20::{Error, ERC20}
   |       ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
   |
11 | /// * `contracts::erc20::{Error`, ERC20}
   |       ~~~~~~~~~~~~~~~~~~~~~~~~~~
Raw output
contracts/src/erc20/extensions/burnable.rs:11:7:w:warning: item in documentation is missing backticks
  --> contracts/src/erc20/extensions/burnable.rs:11:7
   |
11 | /// * contracts::erc20::{Error, ERC20}
   |       ^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
   |
11 | /// * `contracts::erc20::{Error`, ERC20}
   |       ~~~~~~~~~~~~~~~~~~~~~~~~~~


__END__

Check warning on line 12 in contracts/src/erc20/extensions/burnable.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

[clippy] contracts/src/erc20/extensions/burnable.rs#L12

warning: item in documentation is missing backticks
  --> contracts/src/erc20/extensions/burnable.rs:12:7
   |
12 | /// * stylus_sdk::msg
   |       ^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
   |
12 | /// * `stylus_sdk::msg`
   |       ~~~~~~~~~~~~~~~~~
Raw output
contracts/src/erc20/extensions/burnable.rs:12:7:w:warning: item in documentation is missing backticks
  --> contracts/src/erc20/extensions/burnable.rs:12:7
   |
12 | /// * stylus_sdk::msg
   |       ^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
help: try
   |
12 | /// * `stylus_sdk::msg`
   |       ~~~~~~~~~~~~~~~~~


__END__

Check warning on line 13 in contracts/src/erc20/extensions/burnable.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

[clippy] contracts/src/erc20/extensions/burnable.rs#L13

warning: item name ends with its containing module's name
  --> contracts/src/erc20/extensions/burnable.rs:13:14
   |
13 | macro_rules! impl_erc20_burnable {
   |              ^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
   = note: `#[warn(clippy::module_name_repetitions)]` implied by `#[warn(clippy::pedantic)]`
Raw output
contracts/src/erc20/extensions/burnable.rs:13:14:w:warning: item name ends with its containing module's name
  --> contracts/src/erc20/extensions/burnable.rs:13:14
   |
13 | macro_rules! impl_erc20_burnable {
   |              ^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_name_repetitions
   = note: `#[warn(clippy::module_name_repetitions)]` implied by `#[warn(clippy::pedantic)]`


__END__

Check warning on line 317 in contracts/src/erc20/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

[clippy] contracts/src/erc20/mod.rs#L317

warning: docs for function which may panic missing `# Panics` section
   --> contracts/src/erc20/mod.rs:317:5
    |
317 | /     pub fn _update(
318 | |         &mut self,
319 | |         from: Address,
320 | |         to: Address,
321 | |         value: U256,
322 | |     ) -> Result<(), Error> {
    | |__________________________^
    |
note: first possible panic found here
   --> contracts/src/erc20/mod.rs:326:32
    |
326 |               let total_supply = self
    |  ________________________________^
327 | |                 .total_supply()
328 | |                 .checked_add(value)
329 | |                 .expect("Should not exceed `U256::MAX` for `_total_supply`");
    | |____________________________________________________________________________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
    = note: `#[warn(clippy::missing_panics_doc)]` implied by `#[warn(clippy::pedantic)]`
Raw output
contracts/src/erc20/mod.rs:317:5:w:warning: docs for function which may panic missing `# Panics` section
   --> contracts/src/erc20/mod.rs:317:5
    |
317 | /     pub fn _update(
318 | |         &mut self,
319 | |         from: Address,
320 | |         to: Address,
321 | |         value: U256,
322 | |     ) -> Result<(), Error> {
    | |__________________________^
    |
note: first possible panic found here
   --> contracts/src/erc20/mod.rs:326:32
    |
326 |               let total_supply = self
    |  ________________________________^
327 | |                 .total_supply()
328 | |                 .checked_add(value)
329 | |                 .expect("Should not exceed `U256::MAX` for `_total_supply`");
    | |____________________________________________________________________________^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
    = note: `#[warn(clippy::missing_panics_doc)]` implied by `#[warn(clippy::pedantic)]`


__END__