Repository: astral-sh/uv
File: crates/uv/src/lib.rs (Rust)

Code before:
    let environment = EnvironmentOptions::new()?;

    match *project_command {
        ProjectCommand::Init(args) => {
            // Resolve the settings from the command-line arguments and workspace configuration.
            let args = settings::InitSettings::resolve(args, filesystem, environment);
            show_settings!(args);

            // The `--project` arg is being deprecated for `init` with a warning now and an error in preview.
            if explicit_project {
                if globals
                    .preview
                    .is_enabled(PreviewFeatures::INIT_PROJECT_FLAG)
                {
                    bail!(
                        "The `--project` option cannot be used in `uv init`. Use `--directory` or `PATH` instead."
                    )
                }
                let message = {
                    match args.path {
                        Some(_) => {
                            " Since a positional path was provided, the `--project` option has no effect.\nConsider using `--directory` instead."
                        }
                        None => "\nConsider using `uv init <PATH>` instead.",
                    }
                };
                warn_user!(
                    "Use of the `--project` option in `uv init` is deprecated and will be removed in a future release.{}",
                    message
                );
            }

            // Initialize the cache.
            let cache = cache.init()?;

            commands::init(
                project_dir,
                args.path,
                args.name,
                args.package,
                args.kind,
                args.bare,
                args.description,
                args.no_description,
                args.vcs,
                args.build_backend,
                args.no_readme,
                args.author_from,
                args.pin_python,
                args.python,
                args.install_mirrors,

Review comment (suggestion):
The Rust idiom for this would be like `let suggestion = args.path.is_some().then_some("...").unwrap_or("...")`

Code after:
    let environment = EnvironmentOptions::new()?;

    match *project_command {
        ProjectCommand::Init(args) => {
            // Resolve the settings from the command-line arguments and workspace configuration.
            let args = settings::InitSettings::resolve(args, filesystem, environment);
            show_settings!(args);

            // The `--project` arg is being deprecated for `init` with a warning now and an error in preview.
            if explicit_project {
                if globals
                    .preview
                    .is_enabled(PreviewFeatures::INIT_PROJECT_FLAG)
                {
                    bail!(
                        "The `--project` option cannot be used in `uv init`. {}",
                        if args.path.is_some() {
                            "Use `--directory` instead."
                        } else {
                            "Use `--directory` or a positional path instead."
                        }
                    )
                }

                warn_user!(
                    "Use of the `--project` option in `uv init` is deprecated and will be removed in a future release. {}",
                    if args.path.is_some() {
                        "Since a positional path was provided, the `--project` option has no effect. Consider using `--directory` instead."
                    } else {
                        "Consider using `uv init <PATH>` instead."
                    }
                );
            }

            // Initialize the cache.
            let cache = cache.init()?;

            commands::init(
                project_dir,
                args.path,
                args.name,
                args.package,
                args.kind,
                args.bare,
                args.description,
                args.no_description,
                args.vcs,
                args.build_backend,
                args.no_readme,
                args.author_from,
                args.pin_python,