Remove unused code 

An other set of fixes for #5860.  In this pr I reviewed all unused code Scrutinizer issues. The most obvious issues are fixed in this pr. 
even just `return;`