Skip to content

Commit

Permalink
Fix docs of derived Lens
Browse files Browse the repository at this point in the history
  • Loading branch information
maan2003 authored and cmyr committed Jan 10, 2021
1 parent 7545dc7 commit fb434a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ You can find its changes [documented below](#070---2021-01-01).

### Fixed

- Fixed docs of derived Lens ([(#1523)] by [@Maan2003])

### Visual

### Docs
Expand Down Expand Up @@ -590,6 +592,7 @@ Last release without a changelog :(
[#1448]: https://github.com/linebender/druid/pull/1448
[#1463]: https://github.com/linebender/druid/pull/1463
[#1452]: https://github.com/linebender/druid/pull/1452
[#1523]: https://github.com/linebender/druid/pull/1523

[Unreleased]: https://github.com/linebender/druid/compare/v0.6.0...master
[0.6.0]: https://github.com/linebender/druid/compare/v0.5.0...v0.6.0
Expand Down
7 changes: 5 additions & 2 deletions druid-derive/src/lens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ fn derive_struct(input: &syn::DeriveInput) -> Result<proc_macro2::TokenStream, s
// Define lens types for each field
let defs = fields.iter().filter(|f| !f.attrs.ignore).map(|f| {
let field_name = &f.ident.unwrap_named();

let docs = format!(
"Lens for the field `{}` on [`{1}`](super::{1})",
field_name, ty
);
quote! {
/// Lens for the field on #ty
#[doc = #docs]
#[allow(non_camel_case_types)]
#[derive(Debug, Copy, Clone)]
pub struct #field_name;
Expand Down

0 comments on commit fb434a1

Please sign in to comment.