Repository: swc-project/swc
File: crates/swc/src/config/mod.rs (Rust)

Code before:
        comments: Option<&'cmt dyn Comments>,
        config: Option<ModuleConfig>,
        unresolved_mark: Mark,
        resolver: Option<(FileName, Arc<dyn ImportResolver>)>,
        caniuse: impl Fn(Feature) -> bool,
    ) -> Box<dyn Pass + 'cmt> {
        let resolver = if let Some((base, resolver)) = resolver {
            Resolver::Real { base, resolver }
        } else {
            Resolver::Default
        };

        let support_block_scoping = caniuse(Feature::BlockScoping);
        let support_arrow = caniuse(Feature::ArrowFunctions);

        let transform_pass = match config {
            Some(ModuleConfig::CommonJs(config)) => Box::new(modules::common_js::common_js(
                resolver,
                unresolved_mark,
                config,
                modules::common_js::FeatureFlag {
                    support_block_scoping,
                    support_arrow,
                },
            )) as Box<dyn Pass>,
            Some(ModuleConfig::Umd(config)) => Box::new(modules::umd::umd(
                cm,
                resolver,
                unresolved_mark,
                config,
                modules::umd::FeatureFlag {
                    support_block_scoping,
                },
            )),
            Some(ModuleConfig::Amd(config)) => Box::new(modules::amd::amd(
                resolver,
                unresolved_mark,
                config,
                modules::amd::FeatureFlag {
                    support_block_scoping,
                    support_arrow,
                },
                comments,
            )),
            Some(ModuleConfig::SystemJs(config)) => Box::new(modules::system_js::system_js(
                resolver,
                unresolved_mark,
                config,
            )),
            _ => Box::new(noop_pass()),
        };

Review comment (suggestion):
The explicit type cast to `Box<dyn Pass>` is inconsistent with other match arms in this function. While lines 1511, 1520, and 1530 return boxed types without explicit casts, this line includes an explicit cast. For consistency, either add the explicit cast to all arms or remove it from this one.
```suggestion
            )),
```

Code after:
        cm: Arc<SourceMap>,
        comments: Option<&'cmt dyn Comments>,
        config: Option<ModuleConfig>,
        unresolved_mark: Mark,
        resolver: Option<(FileName, Arc<dyn ImportResolver>)>,
        caniuse: impl Fn(Feature) -> bool,
    ) -> Box<dyn Pass + 'cmt> {
        let resolver = if let Some((base, resolver)) = resolver {
            Resolver::Real { base, resolver }
        } else {
            Resolver::Default
        };

        let support_block_scoping = caniuse(Feature::BlockScoping);
        let support_arrow = caniuse(Feature::ArrowFunctions);

        let transform_pass = match config {
            Some(ModuleConfig::CommonJs(config)) => Box::new(modules::common_js::common_js(
                resolver,
                unresolved_mark,
                config,
                modules::common_js::FeatureFlag {
                    support_block_scoping,
                    support_arrow,
                },
            )) as Box<dyn Pass>,
            Some(ModuleConfig::Umd(config)) => Box::new(modules::umd::umd(
                cm,
                resolver,
                unresolved_mark,
                config,
                modules::umd::FeatureFlag {
                    support_block_scoping,
                },
            )),
            Some(ModuleConfig::Amd(config)) => Box::new(modules::amd::amd(
                resolver,
                unresolved_mark,
                config,
                modules::amd::FeatureFlag {
                    support_block_scoping,
                    support_arrow,
                },
                comments,
            )),
            Some(ModuleConfig::SystemJs(config)) => Box::new(modules::system_js::system_js(
                resolver,
                unresolved_mark,
                config,
            )),
            _ => Box::new(noop_pass()),