Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve compiler warning by removing unused line #15381

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Levi0804
Copy link

@Levi0804 Levi0804 commented Nov 23, 2024

Description

This PR removes an unused line from the unit test test_events in the account module (aptos-move/framework/aptos-framework/sources/account.move):
let eventhandle = &borrow_global<Account>(addr).coin_register_events;

How to generate the warning?

To generate the warning, create a module and bring the account module into scope. For example:

module 0x9000::test {
    use aptos_framework::account;
}

now use aptos move test, the following warning could be seen:

warning[W09003]: unused assignment
     ┌─ /home/levi0804/.move/https___github_com_aptos-labs_aptos-core_git_mainnet/aptos-move/framework/aptos-framework/sources/account.move:1538:13
     │
1538 │         let eventhandle = &borrow_global<Account>(addr).coin_register_events;
     │             ^^^^^^^^^^^ Unused assignment or binding for local 'eventhandle'. Consider removing, replacing with '_', or prefixing with '_' (e.g., '_eventhandle')

How Has This Been Tested?

I removed the mentioned line locally from the unit test in the account module and ran aptos move test --skip-fetch-latest-git-deps on a module similar to the one above (0x9000::test), which resolved the compiler warning

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Performance improvement
  • Refactoring
  • Dependency update
  • Documentation update
  • Tests

Copy link

trunk-io bot commented Nov 23, 2024

⏱️ 17m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-move-tests 12m 🟩
rust-cargo-deny 2m 🟩
check-dynamic-deps 1m 🟩
semgrep/ci 29s 🟩
general-lints 25s 🟩
file_change_determinator 12s 🟩
permission-check 6s 🟥🟩
permission-check 5s 🟥🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link
Contributor

@gregnazario gregnazario left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing the real work that kept bothering me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants