Skip to content

Commit

Permalink
ci: update linting toolchain to 1.53 (#403)
Browse files Browse the repository at this point in the history
* ci: update linting toolchain to 1.53

This updates the linting toolchain to latest stable version and
fixes a couple of new warnings.

Signed-off-by: Luca BRUNO <[email protected]>

* ci: move remaining Travis jobs to GitHub workflows

This removes the previous Travis configuration, moving all
remaining jobs into the existing GitHub workflow.

Signed-off-by: Luca BRUNO <[email protected]>
  • Loading branch information
lucab authored Jul 19, 2021
1 parent 1e7736f commit bb90a19
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 49 deletions.
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

0 comments on commit bb90a19

Please sign in to comment.