There are actually a few cases here. I'll first say that it's written as a catch-all, so for some paths it is redundant.

If only a file is given, it would be the first time to_dir is defined. In the case of a to_dir and a to_file given, the to_dir might be altered during normalization if the to_file had a directory segment and/or if some cleaning of the path occurred.