Repository: paritytech/substrate
File: frame/support/procedural/src/pallet/expand/storage.rs (Rust)

Code before:
			#(#cfg_attrs)*
			{
				<#full_ident as #frame_support::storage::StorageEntryMetadataBuilder>::build_metadata(
					#frame_support::sp_std::vec![
						#( #docs, )*
					],
					&mut entries,
				);
			}
		)
	});

	let getters = def.storages.iter().map(|storage| {
		if let Some(getter) = &storage.getter {
			let completed_where_clause =
				super::merge_where_clauses(&[&storage.where_clause, &def.config.where_clause]);

			let ident = &storage.ident;
			let gen = &def.type_use_generics(storage.attr_span);
			let type_impl_gen = &def.type_impl_generics(storage.attr_span);
			let type_use_gen = &def.type_use_generics(storage.attr_span);
			let full_ident = quote::quote_spanned!(storage.attr_span => #ident<#gen> );

			let cfg_attrs = &storage.cfg_attrs;

			// If the storage item is public, just link to it, rather than copy-pasting the docs.
			let getter_doc_line = if matches!(storage.vis, syn::Visibility::Public(_)) {
				format!("An auto-generated getter for [`{}`].", storage.ident)
			} else {
				storage.docs.iter().map(|d| d.into_token_stream().to_string()).join("\n")
			};

			match &storage.metadata {
				Metadata::Value { value } => {
					let query = match storage.query_kind.as_ref().expect("Checked by def") {
						QueryKind::OptionQuery => quote::quote_spanned!(storage.attr_span =>
							Option<#value>
						),
						QueryKind::ResultQuery(error_path, _) => {
							quote::quote_spanned!(storage.attr_span =>
								Result<#value, #error_path>
							)
						},
						QueryKind::ValueQuery => quote::quote!(#value),
					};
					quote::quote_spanned!(storage.attr_span =>
						#(#cfg_attrs)*
						impl<#type_impl_gen> #pallet_ident<#type_use_gen> #completed_where_clause {
							#[doc = #getter_doc_line]
							pub fn #getter() -> #query {
								<

Review comment (suggestion):
```suggestion
			// If the storage item is public, just link to it rather than copy-pasting the docs.
```

Code after:
			#(#cfg_attrs)*
			{
				<#full_ident as #frame_support::storage::StorageEntryMetadataBuilder>::build_metadata(
					#frame_support::sp_std::vec![
						#( #docs, )*
					],
					&mut entries,
				);
			}
		)
	});

	let getters = def.storages.iter().map(|storage| {
		if let Some(getter) = &storage.getter {
			let completed_where_clause =
				super::merge_where_clauses(&[&storage.where_clause, &def.config.where_clause]);

			let ident = &storage.ident;
			let gen = &def.type_use_generics(storage.attr_span);
			let type_impl_gen = &def.type_impl_generics(storage.attr_span);
			let type_use_gen = &def.type_use_generics(storage.attr_span);
			let full_ident = quote::quote_spanned!(storage.attr_span => #ident<#gen> );

			let cfg_attrs = &storage.cfg_attrs;

			// If the storage item is public, just link to it rather than copy-pasting the docs.
			let getter_doc_line = if matches!(storage.vis, syn::Visibility::Public(_)) {
				format!("An auto-generated getter for [`{}`].", storage.ident)
			} else {
				storage.docs.iter().map(|d| d.into_token_stream().to_string()).join("\n")
			};

			match &storage.metadata {
				Metadata::Value { value } => {
					let query = match storage.query_kind.as_ref().expect("Checked by def") {
						QueryKind::OptionQuery => quote::quote_spanned!(storage.attr_span =>
							Option<#value>
						),
						QueryKind::ResultQuery(error_path, _) => {
							quote::quote_spanned!(storage.attr_span =>
								Result<#value, #error_path>
							)
						},
						QueryKind::ValueQuery => quote::quote!(#value),
					};
					quote::quote_spanned!(storage.attr_span =>
						#(#cfg_attrs)*
						impl<#type_impl_gen> #pallet_ident<#type_use_gen> #completed_where_clause {
							#[doc = #getter_doc_line]
							pub fn #getter() -> #query {
								<