You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: bad_string_format_character.rs
    path of file: ./repos/ruff/crates/ruff_linter/src/rules/pylint/rules
    
    the code of the file until where you have to start completion: use std::str::FromStr;

use ruff_diagnostics::{Diagnostic, Violation};
use ruff_macros::{derive_message_formats, violation};
use ruff_python_ast::Expr;
use ruff_python_literal::{
    cformat::{CFormatErrorType, CFormatString},
    format::FormatPart,
    format::FromTemplate,
    format::{FormatSpec, FormatSpecError, FormatString},
};
use ruff_python_parser::{lexer, Mode, StringKind, Tok};
use ruff_text_size::{Ranged, TextRange};

use crate::checkers::ast::Checker;

/// ## What it does
/// Checks for unsupported format typ
    
pub(crate) fn percent(checker: &mut Checker, expr: &Expr) {
    // Grab each string segment (in case there's an implicit concatenation).
    let mut strings: Vec<(TextRange, StringKind)> = vec![];
    for (tok, range) in
        lexer::lex_starts_at(checker.locator().slice(expr), Mode::Module, expr.start()).flatten()
    {
        match tok {
            Tok::String { kind, .. } => strings.push((range, kind)),
            // Break as soon as we find the modulo symbol.
            Tok::Percent => break,
            _ => {}
        }
    }

    // If there are no string segments, abort.
    if strings.is_empty() {
        return;
    }

    for (range, kind) in &strings {
        let string = checker.locator().slice(*range);
        let string = &string
            [usize::from(kind.opener_len())..(string.len() - usize::from(kind.closer_len()))];

        // Parse the format string (e.g. `"%s"`) into a list of `PercentFormat`.
        if let Err(format_error) = CFormatString::from_str(string) {
            if let CFormatErrorType::UnsupportedFormatChar(format_char) = format_error.typ {
                checker.diagnostics.push(Diagnostic::new(
                    BadStringFormatCharacter { format_char },
                    expr.range(),
                ));
            }
        };
    }
}