Skip to content

Move contain outside of mako. #19656

Closed

Description

@emilio

See #19015.

Activity

  1. added
    A-content/css
    on Dec 30, 2017
  2. emilio commented on Dec 30, 2017

    @emilio
    MemberAuthor

    Tentatively assigning it to @stevel98 :)

  3. added
    C-assigned
    on Dec 30, 2017
  4. stevel98 commented on Dec 31, 2017

    @stevel98
    Contributor

    Hi,
    I'm still new to rust, and I'm puzzled over the purpose of the computed_value module under the contains longhand in box.mako.rs.

    pub mod computed_value {
        pub type T = super::SpecifiedValue;
    }
    

    I only see it used in:

    #[inline]
    pub fn get_initial_value() -> computed_value::T {
        computed_value::T::empty()
    }
    

    But wouldn't this be the same as:

    #[inline]
    pub fn get_initial_value() -> computed_value::T {
        Self::empty()
    }
    
  5. CYBAI commented on Dec 31, 2017

    @CYBAI
    Member

    @stevel98

    This block means you can just implement the Contain type inside specified module; then, due to same for both specified and computed, you can just export (pub use) the specified type in computed module. You can check this PR. I think they're not same but similar.

    pub mod computed_value {
        pub type T = super::SpecifiedValue;
    }

    For this block, yeah, you can use Self::empty().

    #[inline]
    pub fn get_initial_value() -> computed_value::T {
        computed_value::T::empty()
    }

    Another note:

    For this case, I didn't try but maybe you don't need this get_initial_value function? I think you can just use empty for initial_value?

    cc @emilio
    If I'm wrong, please correct me :P

  6. emilio commented on Dec 31, 2017

    @emilio
    MemberAuthor

    Yes, but in this case, since the types are the same, it's completely redundant to use computed_value::T instead of Self. This is the kind of stuff we're trying to remove :)

  7. stevel98 commented on Dec 31, 2017

    @stevel98
    Contributor

    Thanks! I'll try to remove it then.

  8. added 2 commits that reference this issue on Jan 4, 2018
    a25c526
    7a9f99e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/cssC-assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions