Repository: sharkdp/bat
File: src/printer.rs (Rust)

Code before:
        {
            if config.style_components.changes() {
                decorations.push(Box::new(LineChangesDecoration::new(&colors)));
            }
        }

        let mut panel_width: usize =
            decorations.len() + decorations.iter().fold(0, |a, x| a + x.width());

        // The grid border decoration isn't added until after the panel_width calculation, since the
        // print_horizontal_line, print_header, and print_footer functions all assume the panel
        // width is without the grid border.
        if config.style_components.grid() && !decorations.is_empty() {
            decorations.push(Box::new(GridBorderDecoration::new(&colors)));
        }

        // Disable the panel if the terminal is too small (i.e. can't fit 5 characters with the
        // panel showing).
        if config.term_width
            < (decorations.len() + decorations.iter().fold(0, |a, x| a + x.width())) + 5
        {
            decorations.clear();
            panel_width = 0;
        }

        let highlighter_and_syntax_set = if input
            .reader
            .content_type
            .map_or(false, |c| c.is_binary() && !config.show_nonprintable)
        {
            (None, assets.get_syntax_set()?)
        } else {
            // Determine the type of syntax for highlighting
            let syntax_in_set =
                match assets.get_syntax(config.language, input, &config.syntax_mapping) {
                    Ok(syntax_in_set) => syntax_in_set,
                    Err(Error(ErrorKind::UndetectedSyntax(_), _)) => {
                        let syntax_set = assets.get_syntax_set()?;
                        let syntax = syntax_set.find_syntax_plain_text();
                        SyntaxReferenceInSet { syntax, syntax_set }
                    }
                    Err(e) => return Err(e),
                };

            (
                Some(HighlightLines::new(syntax_in_set.syntax, theme)),
                syntax_in_set.syntax_set,
            )
        };

        Ok(InteractivePrinter {

Review comment (suggestion):
is it possible to deconstruct the tuple here into separate variables? Does it make sense to do it? My reasoning is just to make lines 200/201 prettier instead of referring to `.0` and `.1`.

Code after:
        {
            if config.style_components.changes() {
                decorations.push(Box::new(LineChangesDecoration::new(&colors)));
            }
        }

        let mut panel_width: usize =
            decorations.len() + decorations.iter().fold(0, |a, x| a + x.width());

        // The grid border decoration isn't added until after the panel_width calculation, since the
        // print_horizontal_line, print_header, and print_footer functions all assume the panel
        // width is without the grid border.
        if config.style_components.grid() && !decorations.is_empty() {
            decorations.push(Box::new(GridBorderDecoration::new(&colors)));
        }

        // Disable the panel if the terminal is too small (i.e. can't fit 5 characters with the
        // panel showing).
        if config.term_width
            < (decorations.len() + decorations.iter().fold(0, |a, x| a + x.width())) + 5
        {
            decorations.clear();
            panel_width = 0;
        }

        let (highlighter, syntax_set) = if input
            .reader
            .content_type
            .map_or(false, |c| c.is_binary() && !config.show_nonprintable)
        {
            (None, assets.get_syntax_set()?)
        } else {
            // Determine the type of syntax for highlighting
            let syntax_in_set =
                match assets.get_syntax(config.language, input, &config.syntax_mapping) {
                    Ok(syntax_in_set) => syntax_in_set,
                    Err(Error(ErrorKind::UndetectedSyntax(_), _)) => {
                        let syntax_set = assets.get_syntax_set()?;
                        let syntax = syntax_set.find_syntax_plain_text();
                        SyntaxReferenceInSet { syntax, syntax_set }
                    }
                    Err(e) => return Err(e),
                };

            (
                Some(HighlightLines::new(syntax_in_set.syntax, theme)),
                syntax_in_set.syntax_set,
            )
        };

        Ok(InteractivePrinter {