mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Merge pull request #19553 from davidbarsky/davidbarsky/fix-rustdoc-tests
internal: fix `NameGenerator`'s and `AnyMap`'s rustdocs
This commit is contained in:
commit
432a3bca90
@ -83,7 +83,7 @@ const USELESS_METHODS: &[&str] = &[
|
|||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # use ide_db::syntax_helpers::suggest_name::NameGenerator;
|
/// # use ide_db::syntax_helpers::suggest_name::NameGenerator;
|
||||||
/// let mut generator = NameGenerator::new();
|
/// let mut generator = NameGenerator::default();
|
||||||
/// assert_eq!(generator.suggest_name("a"), "a");
|
/// assert_eq!(generator.suggest_name("a"), "a");
|
||||||
/// assert_eq!(generator.suggest_name("a"), "a1");
|
/// assert_eq!(generator.suggest_name("a"), "a1");
|
||||||
///
|
///
|
||||||
|
@ -82,12 +82,12 @@ pub type RawMap<A> = hash_map::HashMap<TypeId, Box<A>, BuildHasherDefault<TypeId
|
|||||||
/// ## Example
|
/// ## Example
|
||||||
///
|
///
|
||||||
/// (Here, the [`AnyMap`] convenience alias is used;
|
/// (Here, the [`AnyMap`] convenience alias is used;
|
||||||
/// the first line could use `[anymap::Map][Map]::<[core::any::Any]>::new()`
|
/// the first line could use `[anymap::Map][Map]::<[core::any::Any]>::default()`
|
||||||
/// instead if desired.)
|
/// instead if desired.)
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # use stdx::anymap;
|
/// # use stdx::anymap;
|
||||||
/// let mut data = anymap::AnyMap::new();
|
/// let mut data = anymap::AnyMap::default();
|
||||||
/// assert_eq!(data.get(), None::<&i32>);
|
/// assert_eq!(data.get(), None::<&i32>);
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
@ -100,7 +100,7 @@ pub struct Map<A: ?Sized + Downcast = dyn Any> {
|
|||||||
/// The most common type of `Map`: just using `Any`; `[Map]<dyn [Any]>`.
|
/// The most common type of `Map`: just using `Any`; `[Map]<dyn [Any]>`.
|
||||||
///
|
///
|
||||||
/// Why is this a separate type alias rather than a default value for `Map<A>`?
|
/// Why is this a separate type alias rather than a default value for `Map<A>`?
|
||||||
/// `Map::new()` doesn't seem to be happy to infer that it should go with the default
|
/// `Map::default()` doesn't seem to be happy to infer that it should go with the default
|
||||||
/// value. It's a bit sad, really. Ah well, I guess this approach will do.
|
/// value. It's a bit sad, really. Ah well, I guess this approach will do.
|
||||||
pub type AnyMap = Map<dyn Any>;
|
pub type AnyMap = Map<dyn Any>;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user