Washington needed a top-flight closer for another playoff run - after years without one, and it proving costly every single time - and everyone knew that Papelbon's arm has been shot since coming back from injury.
The question was always whether they'd have to give up one of their top prospects, a Turner, Giolito, Lopez, to get it done. They kept those guys, and kept Michael Taylor, who is possibly another solid trade chip in the offseason.
I like Rivero, but the Nationals are in their competitive window and it's not always about optimal asset management... and really, when is any deadline deal about asset management for the acquiring club? This is one of Washington's better teams to try and win within this window. Given they were against the wall, this is reasonable. Both teams should benefit.
The Pirates get a nice player, with multiple years under control. Nationals fans are likely a lot happier about another year of playoffs where Melancon is there in place of Storen out of the bullpen in the ninth.
Washington might want to grab another middle reliever, if the price is decent.