Remove Unused Declaration Quick Fix

Removes the declaration for a constant, variable, procedure, or line label that isn't used. This operation can break the code if the declaration is actually in use but Rubberduck couldn't find where.

This quick-fix is available for the following inspections:


This quick-fix can be applied as a single operation at the following scopes:
  • Module
  • Project


 This example depicts the state of module(s) before and after applying the quick-fix.

Module1 (Any)
Option Explicit Public Sub DoSomething() Const value = 42 Debug.Print 42 End Sub
Module1 (Any)
Option Explicit Public Sub DoSomething() Debug.Print 42 End Sub

Rubberduck.CodeAnalysis.QuickFixes.Concrete.RemoveUnusedDeclarationQuickFix.cs (Prerelease-v2.5.2.6174)