Skip to content
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

ci: update linting toolchain to 1.53 #403

Merged
merged 2 commits into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
53 changes: 48 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,54 @@ on:
env:
CARGO_TERM_COLOR: always
# Pinned toolchain for linting and benchmarks
ACTIONS_LINTS_TOOLCHAIN: 1.47.0
ACTIONS_LINTS_TOOLCHAIN: 1.53.0
EXTRA_FEATURES: "protobuf push process"

jobs:
tests-stable:
name: "Tests, stable toolchain"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "stable"
default: true
- name: cargo build
run: cargo build
- name: cargo test
run: cargo test
- name: cargo test (extra features)
run: cargo test --no-default-features --features="${{ env['EXTRA_FEATURES'] }}"
- name: cargo package
run : cargo package && cargo package --manifest-path static-metric/Cargo.toml
tests-other-channels:
name: "Tests, unstable toolchain"
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
channel:
- "beta"
- "nightly"
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.channel }}
default: true
- name: cargo build
run: cargo build
- name: cargo test
run: cargo test
- name: cargo build (static-metric)
run: cargo build -p prometheus-static-metric --examples --no-default-features --features="${{ env['EXTRA_FEATURES'] }}"
- name: cargo test (static-metric)
run: cargo test -p prometheus-static-metric --no-default-features --features="${{ env['EXTRA_FEATURES'] }}"
linting:
name: "Lints, pinned toolchain"
runs-on: ubuntu-latest
Expand All @@ -21,15 +66,13 @@ jobs:
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env['ACTIONS_LINTS_TOOLCHAIN'] }}
toolchain: ${{ env['ACTIONS_LINTS_TOOLCHAIN'] }}
default: true
components: rustfmt, clippy
- name: cargo fmt (check)
run: cargo fmt --all -- --check -l
- name: cargo clippy
run: cargo clippy --all -- -D clippy
- name: cargo package
run : cargo package && cargo package --manifest-path static-metric/Cargo.toml
run: cargo clippy --all -- -D clippy::all
criterion:
name: "Benchmarks (criterion)"
runs-on: ubuntu-latest
Expand Down
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl RegistryCore {
let mut id_set = Vec::new();
let mut collector_id: u64 = 0;
for desc in c.desc() {
if id_set.iter().find(|id| **id == desc.id).is_none() {
if !id_set.iter().any(|id| *id == desc.id) {
id_set.push(desc.id);
collector_id = collector_id.wrapping_add(desc.id);
}
Expand Down
4 changes: 2 additions & 2 deletions static-metric/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pub fn is_local_metric(metric_type: Ident) -> bool {

pub fn to_non_local_metric_type(metric_type: Ident) -> Ident {
let metric_type_str = metric_type.to_string();
if metric_type_str.starts_with("Local") {
Ident::new(&metric_type_str[5..], Span::call_site())
if let Some(stripped) = metric_type_str.strip_prefix("Local") {
Ident::new(stripped, Span::call_site())
} else {
metric_type
}
Expand Down