I used to manage a restaurant. All unmarketable but edible waste went to homeless shelters. Remaining inedible but unspoiled food went to pig farmers. Remaining spoiled food went to composting facilities. Our target market loved all of those policies.
Wasted food includes what didn't sell. And honestly, it didn't occur to me that you were suggesting that restaurants would be expected to donate marketable food. Markets, restaurants, etc often lock waste containers, to prevent theft.