]> git.lizzy.rs Git - rust.git/commit
Suggest direct raw-pointer dereference
authorMichal 'vorner' Vaner <vorner@vorner.cz>
Tue, 21 Aug 2018 17:57:59 +0000 (19:57 +0200)
committerMichal 'vorner' Vaner <vorner@vorner.cz>
Tue, 21 Aug 2018 18:03:54 +0000 (20:03 +0200)
commit18f41e54d9c457da3e60735f494bffe92f8a303b
treef9b3d571627fb672846d16ac0a5b043dfa01fd5f
parenta9d496796f091f42c8bac60c5c9ca05e6ca5dcda
Suggest direct raw-pointer dereference

People often come looking for some kind of `as_ref_unchecked` method on
raw pointers that would give them `&T` and not `Option<&T>` when they
are sure the pointer is not NULL.

There's no such method, but taking a reference of the dereferenced
pointer accomplishes the same thing. Therefore, suggest using that, at
the `as_ref` site ‒ it's a place people are likely going to look into.
src/libcore/ptr.rs