Use this tag when question related to unused variables issues as warnings
Questions tagged [unused-variables]
179 questions
6
votes
2 answers
Removing Unused parameters warning in QtCreator
I added this to my .pro file but I stil get warnings :
QMAKE_CXXFLAGS_WARN_OFF = -Wunused-parameter

Youssef Bouhjira
- 1,599
- 2
- 22
- 38
6
votes
1 answer
What is "Unused variable G**** in anonymous function"?
I don't know if it is implementation dependent. Just in case it matters, I'm using Corman Lisp 3.0
When I do something like this:
(loop for v being the hash-values of *my-hash-table*
when (> v 1) sum v)
I get two warnings:
;;; Warning: Unused…

akalenuk
- 3,815
- 4
- 34
- 56
5
votes
0 answers
How can I make sure a callback function always has a certain amount of parameters even if they're not used?
Our backend is built with Express (1.4.0) and Typescript. A route has two callbacks:
Success
Error
At one point, the error callback started being ignored. After lots of debugging, we found out that Express uses the callback parameter count to…

j9k3r
- 153
- 1
- 6
5
votes
1 answer
Getting MatchError when using a placeholder for an unused variable
With Scala 2.13.x, I am getting scala.MatchError: null when I use a placeholder for an unused variable:
scala> object Test {
| val _: Any = null
| }
object Test
scala> Test
scala.MatchError: null
... 41 elided
But with Scala 2.12.x,…

himanshuIIITian
- 5,985
- 6
- 50
- 70
5
votes
1 answer
How can I import a single function from a module in Rust?
I'm fairly new to Rust and coming from Python there are some things that are done very differently. In Python, one can import a single function from a .py file by typing from foo import bar, but I still haven't found any equivalent in Rust.
I have…

Edgar Ramírez Mondragón
- 2,912
- 3
- 19
- 34
5
votes
2 answers
Xcode complains about Unused functions that are used
I have a "MyConstants.h" file that is imported by several classes.
Inside that file I have things like:
static BOOL isIndexValid(NSInteger index) {
return ((index >=0) && (index < 200));
}
This function is extensively used by the classes…

Duck
- 34,902
- 47
- 248
- 470
5
votes
2 answers
gcc warns about unused RAII variable
I have a class called MutexLock, which does as it sounds : it locks a mutex on construction, and releases it upon destruction:
class OpenEXRMutexLock
{
#ifndef HAVE_PTHREADS
public:
OpenEXRMutexLock() : lock(openEXRmutex) { }
…

galinette
- 8,896
- 2
- 36
- 87
5
votes
3 answers
C++ fix unused parameter warning with polymorphism
I get some compiler warnings for my program concerning unused variables, and I would like to know what is an appropriate way to fix this.
I have a function that gets inherited by the base class, and in the implementation of the function for the…

user3047299
- 53
- 3
4
votes
3 answers
Unused loop variables in Lisp
Sometime, I need to iterate $n$ times where $n$ is the number of elements in a list. Of course, I could write something like:
(loop for i from 0 below (list-length l)
do something)
But I like to write rather:
(loop for i from 0
for u in…

Thomas Baruchel
- 7,236
- 2
- 27
- 46
4
votes
1 answer
WebStorm TS: Show all unused functions / variables/ modules etc
WebStorm can detect unused "items" like functions, variables or modules and gives you a fix advice (mostly to remove it). Now this feature is really nice but you have to be inside the file to get the hint. Obviously if you have a large code base…

Stefan
- 14,826
- 17
- 80
- 143
4
votes
1 answer
Gson do not deserialize fields that never used
Current situation
I have a model, where class UserSettingModel have two field : long UserId and have as field one exemplar of class UserSettings ( with many field ) with name Settings.
WARNING : none of this fields used directly in my code ( in…

DQuade
- 303
- 3
- 10
4
votes
0 answers
Effective way to remove unused fields of JRXML report template
Recently I had to remove many groups from my report. It caused that in my report template left a lot of unnecessary fields and variables (the removed groups these fields and variables).
Does anybody know quick way to remove unused fields and…

Dawid Naczke
- 1,144
- 12
- 11
4
votes
1 answer
How to handle unused variables on a method by method basis in JSLINT?
I have a collection of methods which I'm calling through a variable name like so:
var some = factory[some_method](a, b, c);
My problem is that some of the methods I'm calling need a, b, c while some only need a or a, b. No problem for me, but…

frequent
- 27,643
- 59
- 181
- 333
4
votes
1 answer
NetBeans plugin to check for unused CSS/JavaScript selectors?
Is there a NetBeans plugin to check for unused CSS and JavaScript across a project? I know there are tools such as Dust-Me (for Firefox) to do this online for one page, however I am interesting in perhaps a plugin that can look across multiple files…

sempervirescent
- 153
- 1
- 8
4
votes
1 answer
is there any way to find unused defines and structs in make command
I have a huge project that I am re-factoring, there are a lot of define statements that I am changing to enums, defines that I am also changing to const variables in a common file.
while I was re-factoring I found that some of the defines were…

aah134
- 860
- 12
- 25