deps: remove unused variable and code optimization
The for loop, which contains the key declaration may run multiple times as the number of keys
, but each loop will do the same task and that's why the key
becomes unused.
We only need the first element (segment
) of the keys
array. So, avoiding the nested unwanted looping.