You might do a filterNot here

    redirects.filterNot{ url => linksToItself(path, url)}

(put the logging in redirectsToItself)