Remove unused assignments. #1555

Fixes `UnusedAssignment` inspection violations in test code.

Description:
>This inspection points out the cases where a variable value is never used after its assignment, i.e.:  
- the variable never gets read after assignment OR  
- the value is always overwritten with another assignment before the next variable read OR  
- the variable initializer is redundant (for one of the above two reasons) OR  
- the variable is never used.
This commit is contained in:
Michal Kordas 2015-08-19 18:07:51 +02:00 committed by Roman Ivanov
parent 3e6b2028e4
commit 227135b3ac
2 changed files with 1 additions and 4 deletions

View File

@ -59,7 +59,6 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport {
// check null passes
RegexpHeaderCheck instance = new RegexpHeaderCheck();
// check empty string passes
instance = new RegexpHeaderCheck();
String header = "";
instance.setHeader(header);
}
@ -71,7 +70,6 @@ public class RegexpHeaderCheckTest extends BaseFileSetCheckTestSupport {
public void testSetHeaderSimple() {
RegexpHeaderCheck instance = new RegexpHeaderCheck();
// check valid header passes
instance = new RegexpHeaderCheck();
String header = "abc.*";
instance.setHeader(header);
}

View File

@ -185,8 +185,7 @@ public class SuppressionsLoaderTest extends BaseCheckTestSupport {
try {
URL url = new URL("http://checkstyle.sourceforge.net/");
HttpURLConnection urlConnect = (HttpURLConnection) url.openConnection();
@SuppressWarnings("unused")
Object objData = urlConnect.getContent();
urlConnect.getContent();
}
catch (IOException e) {
return false;