dropbox / pb-jelly

A protobuf code generation framework for the Rust language developed at Dropbox.
Apache License 2.0
610 stars 25 forks source link

[pb-jelly-gen] Simplify as_ref().map with as_deref #115

Closed grahamking closed 2 years ago

grahamking commented 2 years ago

From this clippy:

warning: called .as_ref().map(|v| &**v) on an Option value. This can be done more directly by calling self.string_value.as_deref() instead

| self.string_value.as_ref().map(|v| &**v).unwrap_or(&[]) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using as_deref instead: self.string_value.as_deref()

I did some experiments locally and it seems OK. Tests also work.