You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: when RA suggests .deref() and picks a trait to auto-import to bring deref() into scope, it chooses lazy_static::__Deref instead of the more common std::ops::Deref or core::ops::Deref. My Cargo.toml contains lazy_static = "1.4.0" under [dependencies].
VSCode screenshot:
Code to reproduce is below. The issue also occurs if rc::Rc is replaced with cell::RefCell (and .borrow() added to obtain a Ref), but I'm not sure about what happens with other Deref implementors.
use std::rc::Rc;structA{r:Rc<String>,}fnf(){let a = A{r:Rc::new("s".to_owned()),};let s = a.r.der| // Cursor to the right of `der`// ┌──────────────────────────────────────────┐// │³ deref() (use lazy_static::__Deref) │// │³ deref_mut() (use std::ops::DerefMut) │// └──────────────────────────────────────────┘}
RA correctly suggests .deref() as an autocomplete for der, but chooses to auto-import the necessary trait from lazy_static::__Deref, instead of std::ops::Deref or core::ops::Deref, which seem like more reasonable choices. (It correctly offers to import .deref_mut() from std::ops::DerefMut.) In the attached screenshot, pressing <TAB> will insert use lazy_static::__Deref near the top of the file.
Similarly, if you write out deref() without importing anything, the fix-it for the error offers to import or qualify with lazy_static::_Deref (same underlying issue, I assume).
The text was updated successfully, but these errors were encountered:
Description: when RA suggests
.deref()
and picks a trait to auto-import to bringderef()
into scope, it chooseslazy_static::__Deref
instead of the more commonstd::ops::Deref
orcore::ops::Deref
. My Cargo.toml containslazy_static = "1.4.0"
under[dependencies]
.VSCode screenshot:
Code to reproduce is below. The issue also occurs if
rc::Rc
is replaced withcell::RefCell
(and.borrow()
added to obtain aRef
), but I'm not sure about what happens with otherDeref
implementors.RA correctly suggests
.deref()
as an autocomplete forder
, but chooses to auto-import the necessary trait fromlazy_static::__Deref
, instead ofstd::ops::Deref
orcore::ops::Deref
, which seem like more reasonable choices. (It correctly offers to import.deref_mut()
fromstd::ops::DerefMut
.) In the attached screenshot, pressing<TAB>
will insertuse lazy_static::__Deref
near the top of the file.Similarly, if you write out
deref()
without importing anything, the fix-it for the error offers to import or qualify withlazy_static::_Deref
(same underlying issue, I assume).The text was updated successfully, but these errors were encountered: