To me, "doubt if" is slang, and "doubt whether" is very formal.
I doubt if you can do it. (Slang, but very common)
I doubt whether you do do it. (Formal, not common)
I doubt that you can do it, or
I doubt you can do it. (Normal conversation.)
I don't like the rule you were taught. It doesn't reflect very well how we actually use "doubt."