diff --git a/src/cargo/ops/registry/info/mod.rs b/src/cargo/ops/registry/info/mod.rs index e4607d0e32a..39bbb4861a1 100644 --- a/src/cargo/ops/registry/info/mod.rs +++ b/src/cargo/ops/registry/info/mod.rs @@ -1,9 +1,7 @@ //! Implementation of `cargo info`. use anyhow::bail; -use cargo_credential::Operation; use cargo_util_schemas::core::{PackageIdSpec, PartialVersion}; -use crates_io::User; use crate::core::registry::PackageRegistry; use crate::core::{Dependency, Package, PackageId, PackageIdSpecQuery, Registry, Workspace}; @@ -12,7 +10,6 @@ use crate::ops::registry::{get_source_id_with_package_id, RegistryOrIndex, Regis use crate::ops::resolve_ws; use crate::sources::source::QueryKind; use crate::sources::{IndexSummary, SourceConfigMap}; -use crate::util::auth::AuthorizationErrorReason; use crate::util::cache_lock::CacheLockMode; use crate::util::command_prelude::root_manifest; use crate::{CargoResult, GlobalContext}; @@ -79,19 +76,7 @@ pub fn info( let package = registry.get(&[package_id])?; let package = package.get_one(package_id)?; - let owners = try_list_owners( - gctx, - &source_ids, - reg_or_index.as_ref(), - package_id.name().as_str(), - )?; - pretty_view( - package, - &summaries, - &owners, - suggest_cargo_tree_command, - gctx, - )?; + pretty_view(package, &summaries, suggest_cargo_tree_command, gctx)?; Ok(()) } @@ -207,56 +192,6 @@ fn query_summaries( } } -// Try to list the login and name of all owners of a crate. -fn try_list_owners( - gctx: &GlobalContext, - source_ids: &RegistrySourceIds, - reg_or_index: Option<&RegistryOrIndex>, - package_name: &str, -) -> CargoResult>> { - // Only remote registries support listing owners. - if !source_ids.original.is_remote_registry() { - return Ok(None); - } - match super::registry( - gctx, - source_ids, - None, - reg_or_index, - false, - Some(Operation::Read), - ) { - Ok(mut registry) => { - let owners = registry.list_owners(package_name)?; - let names = owners.iter().map(get_username).collect(); - return Ok(Some(names)); - } - Err(err) => { - // If the token is missing, it means the user is not logged in. - // We don't want to show an error in this case. - if err.to_string().contains( - (AuthorizationErrorReason::TokenMissing) - .to_string() - .as_str(), - ) { - return Ok(None); - } - return Err(err); - } - } -} - -fn get_username(u: &User) -> String { - format!( - "{}{}", - u.login, - u.name - .as_ref() - .map(|name| format!(" ({})", name)) - .unwrap_or_default(), - ) -} - fn validate_locked_and_frozen_options( in_workspace: bool, gctx: &GlobalContext, diff --git a/src/cargo/ops/registry/info/view.rs b/src/cargo/ops/registry/info/view.rs index 06ecd5913e2..bc62400e1b7 100644 --- a/src/cargo/ops/registry/info/view.rs +++ b/src/cargo/ops/registry/info/view.rs @@ -15,7 +15,6 @@ use crate::{ pub(super) fn pretty_view( package: &Package, summaries: &[IndexSummary], - owners: &Option>, suggest_cargo_tree_command: bool, gctx: &GlobalContext, ) -> CargoResult<()> { @@ -153,10 +152,6 @@ pub(super) fn pretty_view( gctx, )?; - if let Some(owners) = owners { - pretty_owners(owners, stdout)?; - } - if suggest_cargo_tree_command { suggest_cargo_tree(package_id, stdout)?; } @@ -399,19 +394,6 @@ fn pretty_features( Ok(()) } -fn pretty_owners(owners: &Vec, stdout: &mut dyn Write) -> CargoResult<()> { - let header = HEADER; - - if !owners.is_empty() { - writeln!(stdout, "{header}owners:{header:#}",)?; - for owner in owners { - writeln!(stdout, " {}", owner)?; - } - } - - Ok(()) -} - // Suggest the cargo tree command to view the dependency tree. fn suggest_cargo_tree(package_id: PackageId, stdout: &mut dyn Write) -> CargoResult<()> { let literal = LITERAL; diff --git a/tests/testsuite/cargo_info/features_activated_over_limit_verbose/stderr.term.svg b/tests/testsuite/cargo_info/features_activated_over_limit_verbose/stderr.term.svg index 4856382c623..de41e3894c1 100644 --- a/tests/testsuite/cargo_info/features_activated_over_limit_verbose/stderr.term.svg +++ b/tests/testsuite/cargo_info/features_activated_over_limit_verbose/stderr.term.svg @@ -1,4 +1,4 @@ - +