Repository: rust-lang/rust
File: src/librustdoc/lib.rs (Rust)

Code before:
                        match lint {
                            DelayedLint::AttributeParsing(attribute_lint) => {
                                tcx.node_span_lint(
                                    attribute_lint.lint_id.lint,
                                    attribute_lint.id,
                                    attribute_lint.span,
                                    |diag| {
                                        rustc_lint::decorate_attribute_lint(
                                            tcx.sess,
                                            Some(tcx),
                                            &attribute_lint.kind,
                                            diag,
                                        );
                                    },
                                );
                            }
                        }
                    }
                }
            }

            if render_opts.dep_info().is_some() {
                if let Err(e) = fs::create_dir_all(&render_opts.output) {
                    sess.dcx()
                        .fatal(format!("{output}: {e}", output = render_opts.output.display()));
                }
                rustc_interface::passes::write_dep_info(tcx);
            }

            if let Some(metrics_dir) = &sess.opts.unstable_opts.metrics_dir {
                dump_feature_usage_metrics(tcx, metrics_dir);
            }

            if run_check {
                // Since we're in "check" mode, no need to generate anything beyond this point.
                return;
            }

            info!("going to format");
            match output_format {
                config::OutputFormat::Html => sess.time("render_html", || {
                    run_renderer(
                        krate,
                        render_opts,
                        cache,
                        tcx,
                        |krate, render_opts, cache, tcx| {
                            html::render::Context::init(
                                krate,
                                render_opts,
                                cache,

Review comment (suggestion):
If we end up keeping the `create_dir_all`, you should probably also modify mod `scrape_examples` which also calls `write_dep_info`.

Code after:
                            DelayedLint::AttributeParsing(attribute_lint) => {
                                tcx.node_span_lint(
                                    attribute_lint.lint_id.lint,
                                    attribute_lint.id,
                                    attribute_lint.span,
                                    |diag| {
                                        rustc_lint::decorate_attribute_lint(
                                            tcx.sess,
                                            Some(tcx),
                                            &attribute_lint.kind,
                                            diag,
                                        );
                                    },
                                );
                            }
                        }
                    }
                }
            }

            if render_opts.dep_info().is_some() {
                rustc_interface::passes::write_dep_info(tcx);
            }

            if let Some(metrics_dir) = &sess.opts.unstable_opts.metrics_dir {
                dump_feature_usage_metrics(tcx, metrics_dir);
            }

            if run_check {
                // Since we're in "check" mode, no need to generate anything beyond this point.
                return;
            }

            info!("going to format");
            match output_format {
                config::OutputFormat::Html => sess.time("render_html", || {
                    run_renderer(
                        krate,
                        render_opts,
                        cache,
                        tcx,
                        |krate, render_opts, cache, tcx| {
                            html::render::Context::init(
                                krate,
                                render_opts,
                                cache,
                                tcx,
                                expanded_macros,
                            )
                        },
                    )