a way to mark usages of members/types as unimportant

I'm working on a large project which involves a sizable library of general purpose utilities. I've been using the global inspections to identify areas of code that aren't being used in order to slim down the library. I'm also in the process of retrofitting the library with unit tests. It would be useful to be able to mark usages of members/types that occur in test methods (or related testing code) as being different from other usages that occur in the project's non-test code. This would make it possible to find members/types that are used only in tests and aren't used anywhere else.
It would probably need to be in the form of an annotation attribute set on the test methods themselves which indicate that member/type usages within that method are not significant. This would sort of be like the opposite of how [UsedImplicitly] behaves. For example:

[UsagesInHereAreNotImportantOrWhatever]
[Test]
public void TestSomeMethod()
{
   Assert.IsNotNull(Stuff.SomeMethodThatIsntUsedAnywhereElseExceptThisTest());
}

There would also need to be some changes to the inspections (and possibly context actions) for unused items.

Is there currently a way to do this? Or is there a chance this feature could be added?

Please sign in to leave a comment.