Resolve cargo-shear warnings#8031
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughWorkspace TLS and Tk/Tcl workspace dependencies are disabled and ChangesFeature and Dependency Cleanup
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Cargo.toml`:
- Line 64: The example `custom_tls_providers` is gated on a non-existent feature
name `rustls-graviola` because `rustls-graviola` is only in dev-dependencies and
not declared as an optional dependency/feature; fix by either moving
`rustls-graviola` from `[dev-dependencies]` into `[dependencies]` with `optional
= true` so Cargo creates a `rustls-graviola` feature, or remove
`"rustls-graviola"` from the example's `required-features` and instead gate
`custom_tls_providers` on one of the existing declared features (e.g.,
`rustls/ring`, `ssl-rustls`) in Cargo.toml; update the `[[example]]
custom_tls_providers` stanza and the dependency declaration for
`rustls-graviola` accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 10cfb8ab-63e2-4e33-a992-ebfb19c41e81
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
Cargo.tomlcrates/codegen/Cargo.tomlcrates/stdlib/Cargo.tomlcrates/stdlib/src/lib.rs
| pyo3 = { workspace = true, features = ["auto-initialize"] } | ||
| rustpython-stdlib = { workspace = true } | ||
| ruff_python_parser = { workspace = true } | ||
| rustls-graviola = { workspace = true } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify the example exists and check its feature requirements
fd -t f 'custom_tls_providers.rs' examples
echo "---"
# Check if rustls-graviola is referenced anywhere else as a feature
rg -n 'rustls-graviola' --type tomlRepository: RustPython/RustPython
Length of output: 308
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== custom_tls_providers entry in Cargo.toml =="
rg -n 'custom_tls_providers' Cargo.toml
echo "== Cargo.toml lines 1-140 =="
nl -ba Cargo.toml | sed -n '1,160p'
echo "== Cargo.toml lines 240-360 =="
nl -ba Cargo.toml | sed -n '240,360p'
echo "== Cargo.toml features section =="
rg -n '^\[features\]' -n Cargo.toml
start=$(rg -n '^\[features\]' Cargo.toml | head -n1 | cut -d: -f1)
# print from features start to next section
awk -v s="$start" 'NR>=s {print NR ":" $0}' Cargo.toml | head -n 200Repository: RustPython/RustPython
Length of output: 280
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== custom_tls_providers entry in Cargo.toml =="
rg -n 'custom_tls_providers' Cargo.toml
echo "== Cargo.toml lines 1-160 =="
nl -ba Cargo.toml | sed -n '1,200p'
echo "== Cargo.toml lines 240-420 =="
nl -ba Cargo.toml | sed -n '240,420p'
echo "== Features section =="
rg -n '^\[features\]' Cargo.toml || trueRepository: RustPython/RustPython
Length of output: 280
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# show the features table fully if present
if rg -q '^\[features\]' Cargo.toml; then
start=$(rg -n '^\[features\]' Cargo.toml | head -n1 | cut -d: -f1)
end=$(awk -v s="$start" 'NR>s && $0 ~ /^\[/ {print NR; exit}' Cargo.toml || true)
if [ -z "${end:-}" ]; then end=$(wc -l < Cargo.toml); fi
echo "== Cargo.toml features block (lines $start-$end) =="
nl -ba Cargo.toml | sed -n "${start},${end}p"
fiRepository: RustPython/RustPython
Length of output: 172
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== custom_tls_providers entry in Cargo.toml =="
rg -n 'custom_tls_providers' Cargo.toml
echo
echo "== Cargo.toml lines 50-130 =="
nl -ba Cargo.toml | sed -n '50,140p'
echo
echo "== Cargo.toml lines 260-360 =="
nl -ba Cargo.toml | sed -n '260,360p'
echo
echo "== Cargo.toml features block =="
if rg -q '^\[features\]' Cargo.toml; then
start=$(rg -n '^\[features\]' Cargo.toml | head -n1 | cut -d: -f1)
end=$(awk -v s="$start" 'NR>s && $0 ~ /^\[/ {print NR-1; exit}' Cargo.toml || true)
if [ -z "${end:-}" ]; then end=$(wc -l < Cargo.toml); fi
nl -ba Cargo.toml | sed -n "${start},${end}p"
else
echo "No [features] section in Cargo.toml"
fi
echo
echo "== Dependencies/dev-dependencies around rustls-graviola =="
rg -n 'rustls-graviola' Cargo.tomlRepository: RustPython/RustPython
Length of output: 282
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find the example block for custom_tls_providers and print nearby lines
ex_line=$(rg -n 'name\s*=\s*"custom_tls_providers"' Cargo.toml | head -n1 | cut -d: -f1)
echo "== custom_tls_providers [[example]] block around line $ex_line =="
start=$((ex_line-15)); end=$((ex_line+40))
sed -n "${start},${end}p" Cargo.toml
echo
echo "== rustls-graviola lines in Cargo.toml (with context) =="
rg -n 'rustls-graviola\s*=\s*' Cargo.toml
echo "--- context around each rustls-graviola match ---"
while IFS=: read -r ln _; do
echo "## rustls-graviola context at Cargo.toml:$ln"
sed -n "$((ln-5)),$((ln+10))p" Cargo.toml
done < <(rg -n 'rustls-graviola\s*=\s*' Cargo.toml)
echo
echo "== Search for optional = true near rustls-graviola =="
rg -n 'optional\s*=\s*true' Cargo.toml || true
rg -n 'rustls-graviola.*optional' Cargo.toml || true
echo
echo "== Dependency section headers (dependencies/dev-dependencies) =="
rg -n '^\[(dependencies|dev-dependencies|features)\]' Cargo.toml || true
echo
echo "== [features] block (if present) =="
if rg -q '^\[features\]' Cargo.toml; then
start=$(rg -n '^\[features\]' Cargo.toml | head -n1 | cut -d: -f1)
end=$(awk -v s="$start" 'NR>s && $0 ~ /^\[/ {print NR-1; exit}' Cargo.toml || true)
if [ -z "${end:-}" ]; then end=$(wc -l < Cargo.toml); fi
sed -n "${start},${end}p" Cargo.toml
else
echo "No [features] section in Cargo.toml"
fiRepository: RustPython/RustPython
Length of output: 1457
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== Show Cargo.toml around line 40-110 =="
sed -n '40,110p' Cargo.toml
echo
echo "== Show Cargo.toml around line 260-320 =="
sed -n '260,320p' Cargo.toml
echo
echo "== Find which section rustls-graviola line 64 is in (dependencies/dev-dependencies) =="
# Print the nearest preceding section header for line 64
line=64
sed -n "${line}p" Cargo.toml
echo "Preceding section headers:"
awk -v target="$line" '
NR<=target && $0 ~ /^\[(dependencies|dev-dependencies|features)\]/ {
last=NR ":" $0
}
END { print last }
' Cargo.toml
echo
echo "== Find section header for rustls-graviola line 289 =="
line=289
sed -n "${line}p" Cargo.toml
echo "Preceding section headers:"
awk -v target="$line" '
NR<=target && $0 ~ /^\[(dependencies|dev-dependencies|features|workspace\.dependencies)\]/ {
last=NR ":" $0
}
END { print last }
' Cargo.toml
echo
echo "== Does Cargo.toml define [features] ? =="
if rg -q '^\[features\]' Cargo.toml; then
start=$(rg -n '^\[features\]' Cargo.toml | head -n1 | cut -d: -f1)
end=$(awk -v s="$start" 'NR>s && $0 ~ /^\[/ {print NR-1; exit}' Cargo.toml || true)
if [ -z "${end:-}" ]; then end=$(wc -l < Cargo.toml); fi
echo "Features block lines $start-$end"
sed -n "${start},${end}p" Cargo.toml
else
echo "No [features] section in Cargo.toml"
fi
echo
echo "== Search for optional=true and explicit feature mappings for rustls-graviola =="
rg -n 'rustls-graviola' Cargo.toml
rg -n 'optional\s*=\s*true' Cargo.toml || true
rg -n '^\s*rustls-graviola\s*=' Cargo.toml || true
rg -n '\brustls-graviola\b' Cargo.toml | head -n 50Repository: RustPython/RustPython
Length of output: 5658
Fix example gating: custom_tls_providers requires a feature that no longer exists
[[example]] custom_tls_providers sets required-features = ["rustls-graviola", ...], but rustls-graviola is only declared under [dev-dependencies] and there is no [features] entry for rustls-graviola (and it is not optional = true), so Cargo will treat "rustls-graviola" as an unknown feature and fail to build the example.
Options:
- Move
rustls-graviolato[dependencies]asoptional = true(so therustls-graviolafeature exists), or - Remove
"rustls-graviola"fromrequired-featuresand gate the example via existing features (e.g.,rustls/ring,ssl-rustls, etc.).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Cargo.toml` at line 64, The example `custom_tls_providers` is gated on a
non-existent feature name `rustls-graviola` because `rustls-graviola` is only in
dev-dependencies and not declared as an optional dependency/feature; fix by
either moving `rustls-graviola` from `[dev-dependencies]` into `[dependencies]`
with `optional = true` so Cargo creates a `rustls-graviola` feature, or remove
`"rustls-graviola"` from the example's `required-features` and instead gate
`custom_tls_providers` on one of the existing declared features (e.g.,
`rustls/ring`, `ssl-rustls`) in Cargo.toml; update the `[[example]]
custom_tls_providers` stanza and the dependency declaration for
`rustls-graviola` accordingly.
| ssl-openssl = ["ssl", "openssl", "openssl-sys", "foreign-types-shared", "openssl-probe"] | ||
| ssl-openssl-vendor = ["ssl-openssl", "openssl/vendored"] | ||
| tkinter = ["dep:tk-sys", "dep:tcl-sys", "dep:widestring"] | ||
| # TODO: Fix tkinter |
There was a problem hiding this comment.
We aren't checking it on the CI, I was assuming so.
Enabling this on the CI will require a lot more effort I believe
There was a problem hiding this comment.
we don't need to break local build due to lack of CI support. (though probably it is already broken)
if dependencies are being used out of CI context, we'd better to the build to CI rather then explicitly breaking it
There was a problem hiding this comment.
Sure, I'll revert this part.
The issue with keeping a broken build is that we are still "paying" for the dependencies it brings, even if it's unused. The Cargo.lock will contain those unused dependencies.
Essentially we are getting more deps, without using them:/
Summary
Summary by CodeRabbit
Removals
Chores