Repository: alacritty/alacritty
File: alacritty/src/renderer/rects.rs (Rust)

Code before:
    fn drop(&mut self) {
        unsafe {
            gl::DeleteBuffers(1, &self.vbo);
            gl::DeleteVertexArrays(1, &self.vao);
        }
    }
}

/// Rectangle drawing program.
#[derive(Debug)]
pub struct RectShaderProgram {
    /// Shader program.
    program: ShaderProgram,

    /// Undercurl flag.
    ///
    /// Rect rendering has two modes; one for normal filled rects, and other for undercurls.
    u_is_undercurl: GLint,

    /// Cell width.
    u_cell_width: GLint,

    /// Cell width.
    u_cell_height: GLint,

    /// Terminal padding.
    u_padding_y: GLint,
    u_padding_x: GLint,

    /// Cell width.
    u_undercurl_thickness: GLint,

    /// Undercurl position.
    u_undercurl_position: GLint,
}

impl RectShaderProgram {
    pub fn new() -> Result<Self, ShaderError> {
        let program = ShaderProgram::new(RECT_SHADER_V, RECT_SHADER_F)?;

        Ok(Self {
            u_is_undercurl: program.get_uniform_location(renderer::cstr!("isUndercurl"))?,
            u_cell_width: program.get_uniform_location(renderer::cstr!("cellWidth"))?,
            u_cell_height: program.get_uniform_location(renderer::cstr!("cellHeight"))?,
            u_padding_x: program.get_uniform_location(renderer::cstr!("paddingX"))?,
            u_padding_y: program.get_uniform_location(renderer::cstr!("paddingY"))?,
            u_undercurl_position: program
                .get_uniform_location(renderer::cstr!("undercurlPosition"))?,
            u_undercurl_thickness: program
                .get_uniform_location(renderer::cstr!("undercurlThickness"))?,
            program,

Review comment (suggestion):
```suggestion
    u_padding_x: GLint,
    u_padding_y: GLint,
```

Code after:
        unsafe {
            gl::DeleteBuffers(1, &self.vbo);
            gl::DeleteVertexArrays(1, &self.vao);
        }
    }
}

/// Rectangle drawing program.
#[derive(Debug)]
pub struct RectShaderProgram {
    /// Shader program.
    program: ShaderProgram,

    /// Undercurl flag.
    ///
    /// Rect rendering has two modes; one for normal filled rects, and other for undercurls.
    u_is_undercurl: GLint,

    /// Cell width.
    u_cell_width: GLint,

    /// Cell height.
    u_cell_height: GLint,

    /// Terminal padding.
    u_padding_x: GLint,
    u_padding_y: GLint,

    /// Undercurl thickness.
    u_undercurl_thickness: GLint,

    /// Undercurl position.
    u_undercurl_position: GLint,
}

impl RectShaderProgram {
    pub fn new() -> Result<Self, ShaderError> {
        let program = ShaderProgram::new(RECT_SHADER_V, RECT_SHADER_F)?;

        Ok(Self {
            u_is_undercurl: program.get_uniform_location(cstr!("isUndercurl"))?,
            u_cell_width: program.get_uniform_location(cstr!("cellWidth"))?,
            u_cell_height: program.get_uniform_location(cstr!("cellHeight"))?,
            u_padding_x: program.get_uniform_location(cstr!("paddingX"))?,
            u_padding_y: program.get_uniform_location(cstr!("paddingY"))?,
            u_undercurl_position: program.get_uniform_location(cstr!("undercurlPosition"))?,
            u_undercurl_thickness: program.get_uniform_location(cstr!("undercurlThickness"))?,
            program,
        })
    }