Skip to content

Conversation

@CathalMullan
Copy link
Contributor

Resolves the latest cargo-shear reported issues.

Will unblock #3272.

> cargo shear --expand
shear/misplaced_dependency

  × misplaced dependency `ctor`
    ╭─[opentelemetry-otlp/tests/integration_test/Cargo.toml:18:1]
 17 │ anyhow = { workspace = true }
 18 │ ctor = { workspace = true }
    · ──┬─
    ·   ╰── only used in dev targets
 19 │ uuid = { workspace = true, features = ["v4"] }
    ╰────
  help: move this dependency to `[dev-dependencies]`

shear/misplaced_dependency

  × misplaced dependency `uuid`
    ╭─[opentelemetry-otlp/tests/integration_test/Cargo.toml:19:1]
 18 │ ctor = { workspace = true }
 19 │ uuid = { workspace = true, features = ["v4"] }
    · ──┬─
    ·   ╰── only used in dev targets
 20 │ tracing-subscriber = { workspace = true, features = ["env-filter","registry", "std", "fmt"] }
    ╰────
  help: move this dependency to `[dev-dependencies]`

shear/misplaced_dependency

  × misplaced dependency `opentelemetry-appender-tracing`
    ╭─[opentelemetry-otlp/tests/integration_test/Cargo.toml:24:1]
 23 │ [target.'cfg(unix)'.dependencies]
 24 │ opentelemetry-appender-tracing = { path = "../../../opentelemetry-appender-tracing", default-features = false}
    · ───────────────┬──────────────
    ·                ╰── only used in dev targets
 25 │ opentelemetry-otlp = { path = "../../../opentelemetry-otlp", default-features = false }
    ╰────
  help: move this dependency to `[target.'cfg(unix)'.dev-dependencies]`

shear/misplaced_optional_dependency

  ⚠ misplaced optional dependency `serde_json`
    ╭─[opentelemetry-proto/Cargo.toml:62:1]
 61 │ serde = { workspace = true, optional = true, features = ["serde_derive", "std"] }
 62 │ serde_json = { workspace = true, optional = true }
    · ─────┬────
    ·      ╰── only used in dev targets
 63 │ const-hex = { workspace = true, optional = true }
    ╰────
  help: remove the `optional` flag and move to `[dev-dependencies]`

Advice: 
  ☞ removing an optional dependency may be a breaking change

shear/summary

  ✗ 3 errors
  ⚠ 1 warning

Advice:
  ☞ run with `--fix` to fix 3 issues
  ☞ to suppress an issue within a package
   ╭─[Cargo.toml:2:12]
 1 │ [package.metadata.cargo-shear]
 2 │ ignored = ["crate-name"]
   ·            ──────┬─────
   ·                  ╰── add the crate name here
   ╰────
  ☞ to suppress an issue across a workspace
   ╭─[Cargo.toml:2:12]
 1 │ [workspace.metadata.cargo-shear]
 2 │ ignored = ["crate-name"]
   ·            ──────┬─────
   ·                  ╰── add the crate name here
   ╰────

Changes

  • Removed unused dependencies.
  • Move dependencies only used in tests to dev-dependencies.

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@CathalMullan CathalMullan requested a review from a team as a code owner December 4, 2025 14:57
@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.7%. Comparing base (65969fd) to head (3b4752c).

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #3279   +/-   ##
=====================================
  Coverage   80.7%   80.7%           
=====================================
  Files        129     129           
  Lines      23210   23210           
=====================================
  Hits       18748   18748           
  Misses      4462    4462           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR resolves cargo-shear findings by moving misplaced dependencies to their appropriate sections in the Cargo manifests. The changes ensure dependencies only used in test code are properly categorized as dev-dependencies.

Key changes:

  • Removed serde_json from optional dependencies and the with-serde feature in opentelemetry-proto, moving it to dev-dependencies where it's actually used (in test files only)
  • Moved ctor and uuid from regular dependencies to dev-dependencies in the integration test package, as they're only used in test files
  • Moved opentelemetry-appender-tracing to platform-specific dev-dependencies, as it's only used in Unix-specific test files

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
opentelemetry-proto/Cargo.toml Removed serde_json from the with-serde feature and optional dependencies; it remains in dev-dependencies where it's used for JSON serialization tests
opentelemetry-otlp/tests/integration_test/Cargo.toml Moved ctor, uuid, and opentelemetry-appender-tracing to dev-dependencies sections, properly categorizing test-only dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants