diff --git a/src/implementation/intermediate_public_item.rs b/src/implementation/intermediate_public_item.rs index 9e2b14ab..6dcd4be9 100644 --- a/src/implementation/intermediate_public_item.rs +++ b/src/implementation/intermediate_public_item.rs @@ -310,8 +310,20 @@ impl Display for D<&FnDecl> { impl Display for D<&Vec> { fn fmt(&self, f: &mut Formatter<'_>) -> Result { - if !self.0.is_empty() { - write!(f, "<{}>", Joiner(self.0, ", ", D))?; + let params_without_synthetics: Vec<_> = self + .0 + .iter() + // For now we use a heuristic that I think is pretty solid. + // Once https://github.com/rust-lang/rust/pull/94150 is fixed + // we should replace this with a solid and simple check for `.synthetic` + .filter(|p| !p.name.starts_with("impl ")) + .collect(); + if !¶ms_without_synthetics.is_empty() { + write!( + f, + "<{}>", + Joiner(¶ms_without_synthetics, ", ", |x| D(*x)) + )?; } Ok(()) @@ -416,7 +428,7 @@ impl Display for D<&GenericArgs> { if !inputs.is_empty() { write!( f, - "Fn<{}>{}", + "({}){}", Joiner(inputs, ", ", D), Optional(" -> ", output.as_ref().map(D)) )?; diff --git a/tests/rustdoc_json/bat-v0.19.0-expected.txt b/tests/rustdoc_json/bat-v0.19.0-expected.txt index 2b0f28c0..4490c1fb 100644 --- a/tests/rustdoc_json/bat-v0.19.0-expected.txt +++ b/tests/rustdoc_json/bat-v0.19.0-expected.txt @@ -39,12 +39,12 @@ pub enum variant bat::style::StyleComponent::Rule pub enum variant bat::style::StyleComponent::Snip pub fn bat::Input::from(input: input::Input<'a>) -> Self pub fn bat::Input::from_bytes(bytes: &'a [u8]) -> Self -pub fn bat::Input::from_file: AsRef>(path: impl AsRef) -> Self +pub fn bat::Input::from_file(path: impl AsRef) -> Self pub fn bat::Input::from_reader(reader: R) -> Self pub fn bat::Input::from_stdin() -> Self -pub fn bat::Input::kind: Into>(self, kind: impl Into) -> Self -pub fn bat::Input::name: AsRef>(self, name: impl AsRef) -> Self -pub fn bat::Input::title: Into>(self, title: impl Into) -> Self +pub fn bat::Input::kind(self, kind: impl Into) -> Self +pub fn bat::Input::name(self, name: impl AsRef) -> Self +pub fn bat::Input::title(self, title: impl Into) -> Self pub fn bat::MappingTarget::clone(&self) -> MappingTarget<'a> pub fn bat::MappingTarget::eq(&self, other: &MappingTarget<'a>) -> bool pub fn bat::MappingTarget::fmt(&self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result @@ -60,12 +60,12 @@ pub fn bat::PrettyPrinter::header(&mut self, yes: bool) -> &mut Self pub fn bat::PrettyPrinter::highlight(&mut self, line: usize) -> &mut Self pub fn bat::PrettyPrinter::highlight_range(&mut self, from: usize, to: usize) -> &mut Self pub fn bat::PrettyPrinter::input(&mut self, input: Input<'a>) -> &mut Self -pub fn bat::PrettyPrinter::input_file: AsRef>(&mut self, path: impl AsRef) -> &mut Self +pub fn bat::PrettyPrinter::input_file(&mut self, path: impl AsRef) -> &mut Self pub fn bat::PrettyPrinter::input_files(&mut self, paths: I) -> &mut Self where I: IntoIterator, P: AsRef pub fn bat::PrettyPrinter::input_from_bytes(&mut self, content: &'a [u8]) -> &mut Self pub fn bat::PrettyPrinter::input_from_reader(&mut self, reader: R) -> &mut Self pub fn bat::PrettyPrinter::input_stdin(&mut self) -> &mut Self -pub fn bat::PrettyPrinter::inputs>: IntoIterator>>(&mut self, inputs: impl IntoIterator>) -> &mut Self +pub fn bat::PrettyPrinter::inputs(&mut self, inputs: impl IntoIterator>) -> &mut Self pub fn bat::PrettyPrinter::language(&mut self, language: &'a str) -> &mut Self pub fn bat::PrettyPrinter::line_numbers(&mut self, yes: bool) -> &mut Self pub fn bat::PrettyPrinter::line_ranges(&mut self, ranges: LineRanges) -> &mut Self @@ -79,7 +79,7 @@ pub fn bat::PrettyPrinter::syntax_mapping(&mut self, mapping: SyntaxMapping<'a>) pub fn bat::PrettyPrinter::syntaxes(&self) -> impl Iterator pub fn bat::PrettyPrinter::tab_width(&mut self, tab_width: Option) -> &mut Self pub fn bat::PrettyPrinter::term_width(&mut self, width: usize) -> &mut Self -pub fn bat::PrettyPrinter::theme: AsRef>(&mut self, theme: impl AsRef) -> &mut Self +pub fn bat::PrettyPrinter::theme(&mut self, theme: impl AsRef) -> &mut Self pub fn bat::PrettyPrinter::themes(&self) -> impl Iterator pub fn bat::PrettyPrinter::true_color(&mut self, yes: bool) -> &mut Self pub fn bat::PrettyPrinter::use_italics(&mut self, yes: bool) -> &mut Self @@ -102,10 +102,10 @@ pub fn bat::assets::HighlightingAssets::default_theme() -> &'static str pub fn bat::assets::HighlightingAssets::fmt(&self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result pub fn bat::assets::HighlightingAssets::from_binary() -> Self pub fn bat::assets::HighlightingAssets::from_cache(cache_path: &Path) -> Result -pub fn bat::assets::HighlightingAssets::get_syntax_for_path: AsRef>(&self, path: impl AsRef, mapping: &SyntaxMapping<'_>) -> Result> +pub fn bat::assets::HighlightingAssets::get_syntax_for_path(&self, path: impl AsRef, mapping: &SyntaxMapping<'_>) -> Result> pub fn bat::assets::HighlightingAssets::get_syntaxes(&self) -> Result<&[SyntaxReference]> pub fn bat::assets::HighlightingAssets::set_fallback_theme(&mut self, theme: &'static str) -pub fn bat::assets::HighlightingAssets::syntax_for_file_name: AsRef>(&self, file_name: impl AsRef, mapping: &SyntaxMapping<'_>) -> Option<&SyntaxReference> +pub fn bat::assets::HighlightingAssets::syntax_for_file_name(&self, file_name: impl AsRef, mapping: &SyntaxMapping<'_>) -> Option<&SyntaxReference> pub fn bat::assets::HighlightingAssets::syntaxes(&self) -> &[SyntaxReference] pub fn bat::assets::HighlightingAssets::themes(&self) -> impl Iterator pub fn bat::assets::SyntaxReferenceInSet::fmt(&self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result @@ -129,7 +129,7 @@ pub fn bat::config::VisibleLines::fmt(&self, f: &mut $crate::fmt::Formatter<'_>) pub fn bat::config::get_pager_executable(config_pager: Option<&str>) -> Option pub fn bat::controller::Controller::new<'a>(config: &'a Config<'_>, assets: &'a HighlightingAssets) -> Controller<'a> pub fn bat::controller::Controller::run(&self, inputs: Vec>) -> Result -pub fn bat::controller::Controller::run_with_error_handler>(&self, inputs: Vec>, handle_error: impl FnFn<&Error, &mut Write>) -> Result +pub fn bat::controller::Controller::run_with_error_handler(&self, inputs: Vec>, handle_error: impl Fn(&Error, &mut Write)) -> Result pub fn bat::error::Error::fmt(&self, __formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result pub fn bat::error::Error::fmt(&self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result pub fn bat::error::Error::from(s: &'static str) -> Self @@ -146,12 +146,12 @@ pub fn bat::input::Input::description_mut(&mut self) -> &mut InputDescription pub fn bat::input::Input::from(_: Input<'a>) -> Self pub fn bat::input::Input::from_reader(reader: Box) -> Self pub fn bat::input::Input::is_stdin(&self) -> bool -pub fn bat::input::Input::ordinary_file: AsRef>(path: impl AsRef) -> Self +pub fn bat::input::Input::ordinary_file(path: impl AsRef) -> Self pub fn bat::input::Input::stdin() -> Self -pub fn bat::input::Input::with_name: AsRef>(self, provided_name: Option>) -> Self +pub fn bat::input::Input::with_name(self, provided_name: Option>) -> Self pub fn bat::input::InputDescription::clone(&self) -> InputDescription pub fn bat::input::InputDescription::kind(&self) -> Option<&String> -pub fn bat::input::InputDescription::new: Into>(name: impl Into) -> Self +pub fn bat::input::InputDescription::new(name: impl Into) -> Self pub fn bat::input::InputDescription::set_kind(&mut self, kind: Option) pub fn bat::input::InputDescription::set_summary(&mut self, summary: Option) pub fn bat::input::InputDescription::set_title(&mut self, title: Option) diff --git a/tests/rustdoc_json/syntect-v4.6.0-expected.txt b/tests/rustdoc_json/syntect-v4.6.0-expected.txt index e0396fbb..7eb91f59 100644 --- a/tests/rustdoc_json/syntect-v4.6.0-expected.txt +++ b/tests/rustdoc_json/syntect-v4.6.0-expected.txt @@ -330,7 +330,7 @@ pub fn syntect::parsing::ScopeRepository::build(&mut self, s: &str) -> Result) -> $crate::fmt::Result pub fn syntect::parsing::ScopeRepository::to_string(&self, scope: Scope) -> String pub fn syntect::parsing::ScopeStack::apply(&mut self, op: &ScopeStackOp) -pub fn syntect::parsing::ScopeStack::apply_with_hook(&mut self, op: &ScopeStackOp, hook: F) where F: FnMutFn +pub fn syntect::parsing::ScopeStack::apply_with_hook(&mut self, op: &ScopeStackOp, hook: F) where F: FnMut(BasicScopeStackOp, &[Scope]) pub fn syntect::parsing::ScopeStack::as_slice(&self) -> &[Scope] pub fn syntect::parsing::ScopeStack::bottom_n(&self, n: usize) -> &[Scope] pub fn syntect::parsing::ScopeStack::clone(&self) -> ScopeStack