incoporate suggestion from huonw to move code into lint.rs