]>
git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: add unused mut lint
gcc/rust/ChangeLog:
* checks/lints/unused/rust-unused-checker.cc (UnusedChecker::UnusedChecker):
Add warning for identifier pattern and field ident pattern in struct
(UnusedChecker::visit): Add methods.
* checks/lints/unused/rust-unused-checker.h: Same here.
* checks/lints/unused/rust-unused-collector.cc (UnusedCollector::UnusedCollector):
Collect unused mut variables
(UnusedCollector::visit): Add methods.
* checks/lints/unused/rust-unused-collector.h: Same here.
* checks/lints/unused/rust-unused-context.cc (UnusedContext::remove_assign):
Add methods for unused mut set.
(UnusedContext::add_mut): Same here.
(UnusedContext::remove_mut): Same here.
(UnusedContext::is_mut_used): Same here.
* checks/lints/unused/rust-unused-context.h: Same here.
gcc/testsuite/ChangeLog:
* rust/compile/unused-mut-identifier_0.rs: New test.
* rust/compile/unused-mut-struct-field_0.rs: New test.
Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.com>