-
Notifications
You must be signed in to change notification settings - Fork 139
Clippy updates #672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
marosset
wants to merge
4
commits into
hyperlight-dev:main
Choose a base branch
from
marosset:clippy-updates
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Clippy updates #672
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8ef999c
Run a more exhasutive clippy check
marosset 4417555
Updating dep_rust.yaml to run clippy and other code checks as a seperate
marosset cf38285
Fix clippy warnings for hyperlight-guest
marosset 8ef120b
More clippy fixes for hyperlight_guest_bin
marosset File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,49 @@ defaults: | |
shell: bash | ||
|
||
jobs: | ||
code-checks: | ||
if: ${{ inputs.docs_only == 'false' }} | ||
timeout-minutes: 60 | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
hypervisor: ['hyperv-ws2025', kvm] | ||
config: [debug, release] | ||
runs-on: ${{ fromJson( | ||
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-amd"]', | ||
(matrix.hypervisor == 'hyperv-ws2025') && 'Windows' || 'Linux', | ||
matrix.hypervisor == 'hyperv-ws2025' && 'win2025' || 'kvm')) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: hyperlight-dev/[email protected] | ||
with: | ||
rust-toolchain: "1.85" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Does not check for updated Cargo.lock files for test rust guests as this causes an issue with this checkwhen deoendabot updates dependencies in common crates | ||
- name: Ensure up-to-date Cargo.lock | ||
run: | | ||
cargo fetch --locked | ||
|
||
- name: fmt | ||
run: just fmt-check | ||
|
||
- name: clippy | ||
if: ${{ (runner.os == 'Windows' )}} | ||
run: | | ||
just clippy ${{ matrix.config }} | ||
just clippy-guests ${{ matrix.config }} | ||
|
||
- name: clippy exhaustive check | ||
if: ${{ (runner.os == 'Linux' )}} | ||
run: | | ||
just clippy-exhaustive ${{ matrix.config }} | ||
|
||
- name: Verify MSRV | ||
run: ./dev/verify-msrv.sh hyperlight-host hyperlight-guest hyperlight-guest-bin hyperlight-common | ||
|
||
build: | ||
if: ${{ inputs.docs_only == 'false' }} | ||
timeout-minutes: 60 | ||
|
@@ -61,19 +104,6 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: fmt | ||
run: just fmt-check | ||
|
||
- name: clippy | ||
run: | | ||
just clippy ${{ matrix.config }} | ||
just clippy-guests ${{ matrix.config }} | ||
|
||
# Does not check for updated Cargo.lock files for test rust guests as this causes an issue with this checkwhen deoendabot updates dependencies in common crates | ||
- name: Ensure up-to-date Cargo.lock | ||
run: | | ||
cargo fetch --locked | ||
|
||
- name: Get gh action service name | ||
if: ${{ (runner.os == 'Windows' )}} | ||
run: (Get-Service actions.runner.*) | Foreach { $_.Name, $_.UserName, $_.ServiceType } | ||
|
@@ -93,9 +123,6 @@ jobs: | |
- name: Build | ||
run: just build ${{ matrix.config }} | ||
|
||
- name: Verify MSRV | ||
run: ./dev/verify-msrv.sh hyperlight-host hyperlight-guest hyperlight-guest-bin hyperlight-common | ||
|
||
- name: Run Rust tests | ||
env: | ||
CARGO_TERM_COLOR: always | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# Check for required arguments | ||
if [[ $# -lt 2 ]]; then | ||
echo "Usage: $0 <package> <target>" >&2 | ||
echo "Example: $0 hyperlight-host debug" >&2 | ||
exit 1 | ||
fi | ||
|
||
PACKAGE="$1" | ||
TARGET="$2" | ||
|
||
# Convert target for cargo profile | ||
PROFILE=$([ "$TARGET" = "debug" ] && echo "dev" || echo "$TARGET") | ||
|
||
# Required features needed so the rust packages can compile | ||
if [[ "$PACKAGE" == "hyperlight-host" ]]; then | ||
REQUIRED_FEATURES=("kvm" "mshv3") | ||
elif [[ "$PACKAGE" == "hyperlight-guest-bin" ]]; then | ||
REQUIRED_FEATURES=("printf") | ||
else | ||
REQUIRED_FEATURES=() | ||
fi | ||
|
||
# Get all features for the package (excluding default and required features) | ||
# Always exclude "default", and exclude any required features using jq | ||
features=$(cargo metadata --format-version 1 --no-deps | jq -r --arg pkg "$PACKAGE" '.packages[] | select(.name == $pkg) | .features | keys[] | select(. != "default" and (IN($ARGS.positional[])|not))' --args "${REQUIRED_FEATURES[@]}" || true) | ||
|
||
# Convert required features array to comma-separated string for cargo | ||
if [[ ${#REQUIRED_FEATURES[@]} -gt 0 ]]; then | ||
marosset marked this conversation as resolved.
Show resolved
Hide resolved
|
||
required_features_str=$(IFS=,; echo "${REQUIRED_FEATURES[*]}") | ||
marosset marked this conversation as resolved.
Show resolved
Hide resolved
|
||
else | ||
required_features_str="" | ||
fi | ||
|
||
# Test with minimal features | ||
if [[ ${#REQUIRED_FEATURES[@]} -gt 0 ]]; then | ||
echo "Testing $PACKAGE with required features only ($required_features_str)..." | ||
(set -x; cargo clippy -p "$PACKAGE" --all-targets --no-default-features --features "$required_features_str" --profile="$PROFILE" -- -D warnings) | ||
else | ||
echo "Testing $PACKAGE with no features..." | ||
(set -x; cargo clippy -p "$PACKAGE" --all-targets --no-default-features --profile="$PROFILE" -- -D warnings) | ||
fi | ||
|
||
echo "Testing $PACKAGE with default features..." | ||
(set -x; cargo clippy -p "$PACKAGE" --all-targets --profile="$PROFILE" -- -D warnings) | ||
|
||
# Test each additional feature individually | ||
for feature in $features; do | ||
marosset marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if [[ ${#REQUIRED_FEATURES[@]} -gt 0 ]]; then | ||
echo "Testing $PACKAGE with feature: $required_features_str,$feature" | ||
(set -x; cargo clippy -p "$PACKAGE" --all-targets --no-default-features --features "$required_features_str,$feature" --profile="$PROFILE" -- -D warnings) | ||
else | ||
echo "Testing $PACKAGE with feature: $feature" | ||
(set -x; cargo clippy -p "$PACKAGE" --all-targets --no-default-features --features "$feature" --profile="$PROFILE" -- -D warnings) | ||
fi | ||
done | ||
|
||
# Test all features together | ||
if [[ -n "$features" ]]; then | ||
all_features=$(echo $features | tr '\n' ',' | sed 's/,$//') | ||
marosset marked this conversation as resolved.
Show resolved
Hide resolved
marosset marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if [[ ${#REQUIRED_FEATURES[@]} -gt 0 ]]; then | ||
marosset marked this conversation as resolved.
Show resolved
Hide resolved
|
||
echo "Testing $PACKAGE with all features: $required_features_str,$all_features" | ||
(set -x; cargo clippy -p "$PACKAGE" --all-targets --no-default-features --features "$required_features_str,$all_features" --profile="$PROFILE" -- -D warnings) | ||
else | ||
echo "Testing $PACKAGE with all features: $all_features" | ||
(set -x; cargo clippy -p "$PACKAGE" --all-targets --no-default-features --features "$all_features" --profile="$PROFILE" -- -D warnings) | ||
fi | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.