rustdoc: Move display_fn
struct inside display_fn
This makes it clear that it's an implementation detail of `display_fn` and shouldn't be used elsewhere, and it enforces in the compiler that no one else can use it.
This commit is contained in:
parent
bf193d69fe
commit
c34faadfda
@ -1322,9 +1322,6 @@ impl clean::GenericArg {
|
||||
}
|
||||
|
||||
crate fn display_fn(f: impl FnOnce(&mut fmt::Formatter<'_>) -> fmt::Result) -> impl fmt::Display {
|
||||
WithFormatter(Cell::new(Some(f)))
|
||||
}
|
||||
|
||||
struct WithFormatter<F>(Cell<Option<F>>);
|
||||
|
||||
impl<F> fmt::Display for WithFormatter<F>
|
||||
@ -1335,3 +1332,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
(self.0.take()).unwrap()(f)
|
||||
}
|
||||
}
|
||||
|
||||
WithFormatter(Cell::new(Some(f)))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user