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: string_in_exception.rs
    path of file: ./repos/ruff/crates/ruff_linter/src/rules/flake8_errmsg/rules
    
    the code of the file until where you have to start completion: use ruff_python_ast::{self as ast, Arguments, Expr, Stmt};
use ruff_source_file::Locator;
use ruff_text_size::Ranged;

use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation};
use ruff_macros::{derive_message_formats, violation};
use ruff_python_ast::whitespace;
use ruff_python_codegen::Styli
    
pub(crate) fn string_in_exception(checker: &mut Checker, stmt: &Stmt, exc: &Expr) {
    if let Expr::Call(ast::ExprCall {
        arguments: Arguments { args, .. },
        ..
    }) = exc
    {
        if let Some(first) = args.first() {
            match first {
                // Check for string literals.
                Expr::StringLiteral(ast::ExprStringLiteral { value: string, .. }) => {
                    if checker.enabled(Rule::RawStringInException) {
                        if string.len() >= checker.settings.flake8_errmsg.max_string_length {
                            let mut diagnostic =
                                Diagnostic::new(RawStringInException, first.range());
                            if let Some(indentation) =
                                whitespace::indentation(checker.locator(), stmt)
                            {
                                diagnostic.set_fix(generate_fix(
                                    stmt,
                                    first,
                                    indentation,
                                    checker.stylist(),
                                    checker.locator(),
                                ));
                            }
                            checker.diagnostics.push(diagnostic);
                        }
                    }
                }
                // Check for f-strings.
                Expr::FString(_) => {
                    if checker.enabled(Rule::FStringInException) {
                        let mut diagnostic = Diagnostic::new(FStringInException, first.range());
                        if let Some(indentation) = whitespace::indentation(checker.locator(), stmt)
                        {
                            diagnostic.set_fix(generate_fix(
                                stmt,
                                first,
                                indentation,
                                checker.stylist(),
                                checker.locator(),
                            ));
                        }
                        checker.diagnostics.push(diagnostic);
                    }
                }
                // Check for .format() calls.
                Expr::Call(ast::ExprCall { func, .. }) => {
                    if checker.enabled(Rule::DotFormatInException) {
                        if let Expr::Attribute(ast::ExprAttribute { value, attr, .. }) =
                            func.as_ref()
                        {
                            if attr == "format" && value.is_literal_expr() {
                                let mut diagnostic =
                                    Diagnostic::new(DotFormatInException, first.range());
                                if let Some(indentation) =
                                    whitespace::indentation(checker.locator(), stmt)
                                {
                                    diagnostic.set_fix(generate_fix(
                                        stmt,
                                        first,
                                        indentation,
                                        checker.stylist(),
                                        checker.locator(),
                                    ));
                                }
                                checker.diagnostics.push(diagnostic);
                            }
                        }
                    }
                }
                _ => {}
            }
        }
    }
}