Yes WD40 can be used in your toilet to clean stains, rust and sediment off the inside of the toilet bowl.
Just spray the WD40 onto the inside of the toilet bowl and let it sit for awhile then you can use the toilet brush to scrub the toilet bowl like you normally would.
After that then follow up by using some regular toilet bowl cleaner to get rid of the WD40 smell in the bathroom.
The WD40 will take the rust, stains and sediment right off the inside of the toilet bowl without having to scrub the toilet so hard.