Use this tag when question related to unused variables issues as warnings
Questions tagged [unused-variables]
179 questions
2
votes
1 answer
'Expression myExpression unused' in NSString when using variables
I have this method where I try to set the result in "_result". If I use a formatted string to assigned it to "_result" it gives me the error 'Expression result unused'. The error does not show up if I use a plain string as @" done", and NSlog prints…

radu Seserman
- 25
- 4
1
vote
1 answer
ESLint no-unused-var error for DI variables in Angular
I've got an Angular 14.2 Project and I am trying to setup ESLint for it. The problem is that I get false positives for the no-unused-var error and it seems like it only does this for variables which are included via dependency injection in the…

Sebi.E
- 116
- 2
- 12
1
vote
1 answer
Will the JVM optimise out unused fields
I'm trying to get to learn more about the JVM when it comes to optimising my code and was curious whether (or more specifically in which ways) it optimises out unused fields?
I assume that if you have a field within a class that is never written too…

slit bodmod
- 51
- 5
1
vote
0 answers
For same properties Intellij shows that one of them is unused
I have 2 properties identically used, but one of them is shown as unused. I cannot find any dependencies or rules, why I have half of properties inspected by Intellij Ultimate that way.
Any thoughts? :)
Unused property
"Unused" property usages
Where…

Alex Shostak
- 11
- 4
1
vote
1 answer
VScode doesn't suggest unused declarations
I'm making a flutter app with VScode and I have a lot of unused variables declared at the top of the code, but it doesn't show me the underline. Is there a way to setting this?
P.D:The rest of unused code works.
Thank you!

Gal Nezah
- 23
- 1
- 9
1
vote
1 answer
linfun function problem (unused arguments)
I'm trying to run this code, but I'm having some problem with the linfun function, and I don't know how to fix it.
The error is:
"Error in linfun(a = x.T, d = -sum(x.T * w)) : unused arguments (a =
x.T, d = -sum(x.T * w))"
Does someone know how to…

economiststudent
- 11
- 1
1
vote
1 answer
Sonarqube complaining about unused variable in for loop
In my project I have a simple function that calculates the length of an iterable (as I don't think there is an easy way to get it? No .size() or .length() is accepted?) Here is the code:
public int getIterableSize(Iterable users){
int…

Pim_vh
- 143
- 1
- 14
1
vote
1 answer
error: variable 'raw' has initializer but incomplete type. (YES I've searched and read similar questions!)
I am teaching myself C. I have been following the tutorial Here on how to make a text editor using C. I've installed cygwin, and installed the necessary parts based on the tutorial. I got as far as page 2, when I hit a compiler error.
$ make
cc…

Zenichi
- 13
- 2
1
vote
0 answers
Disable warning for unused structured bindings
I'm extracting a tuple with auto [...] but I'm only using some of the tuple coordinates.
I wanted to know if there is some elegant way to avoid the unused-variable compiler warning?
Here is my code.
#include
#include
#include…

OrenIshShalom
- 5,974
- 9
- 37
- 87
1
vote
3 answers
How to write the HTML code for the inline element showing an image for use in webpage?
I'm writing my first code in an interactive/follow-along program through Cengage (MindTap). The program is instructing me to "write the HTML code for the inline element showing the sky image to use in the webpage." I am supposed to create a…

jaydajayda
- 65
- 7
1
vote
0 answers
Prefixing with underscore to remove unused code warning. What am I actually telling the compiler?
When using a for loop
for i in 1..10 {}
The compiler tells me to prefix i like this: _i.
What am I actually conveying by putting the underscore in front of variables or functions?

Viktor
- 61
- 6
1
vote
1 answer
Unused arguments in SOM function
This is my first post and I am newbie in R. I'm trying to train a Self-Organizing Map. My data is a matrix of 2304 instances with 7 features each instance ([2304x7])
Following the example codes with (like wines' dataset) I have no problem but when I…

JP Manzano
- 11
- 5
1
vote
1 answer
unused-variable warning is raised not for all unused static const variables
Could you help me to understand why I get unused-variable warning not for all unused static const variables?
I prepared a simple code. Here are 2 files main.cpp and incl.h.
incl.h
#ifndef INCL_H
#define INCL_H
struct A
{
static A& instance()
…

Алексей Шалашов
- 203
- 1
- 6
1
vote
0 answers
Intellij unused Injects are not detected
I am trying to clean my code and delete @Inject fields in my classes which are not used. I tried to follow this https://blog.jetbrains.com/idea/2009/04/global-unused-declaration-inspection/ in order to achieve this. Somebody seems to have succeeded…

Sly
- 51
- 5
1
vote
0 answers
Dead code analysis in VisualStudio 2013 Pro
I need to remove unused variables and functions(Deadcode) in a c code. Can I use VisualStudio 2013 Pro code analysis to find unused c variables? Because in the rule set, Microsoft.Performance rules are not available for unmanaged code. is there any…

user7688425
- 11
- 1