How about this? This would avoid creating the short-lived variable `sort`:

```ruby
hash[:sort] = Mongo::Support.format_order_clause(opts.delete(:sort)) if opts.key?(:sort)
```