If you introduce unsafe into a program, it is not pure.
You can run a linter or something to check if your program uses unsafe anywhere.
Purity is a spectrum, not a binary, The more impurities you add, the more likely your program will not behave reasonably (as in, not in accordance with the simple logical rules of referential transparency).