Skip to content

Commit

Permalink
ci: refactored linter by changing toolchain
Browse files Browse the repository at this point in the history
Signed-off-by: rjtch <tchuinkoufongue@gmail.com>
  • Loading branch information
rjtch committed Mar 3, 2024
1 parent 3b0adce commit 965cf4a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
toolchain: stable
components: clippy, rustfmt
- name: Install development tools
uses: taiki-e/install-action@v2
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
---
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
permissions:
pull-requests: write
contents: write

pull-requests: write
on:
push:
branches:
- main

jobs:
release-plz:
Expand All @@ -19,14 +18,12 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
# we use Release-plz-token (personal token) to explicitly specify github-actions
# that it is the user who is running the action.
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Run release-plz
uses: MarcoIeni/release-plz-action@v0.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
15 changes: 11 additions & 4 deletions cdevents-sdk/src/uri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// - http::Uri, more mature, but doesn't support uri-reference, and normalize url when generate string
//TODO impl the check difference for Uri and Uri-reference

use std::fmt::Display;
use std::str::FromStr;

use serde::{Serialize, Deserialize};
Expand Down Expand Up @@ -53,9 +52,17 @@ impl TryFrom<&str> for Uri {
}
}

impl Display for Uri {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0.as_str().to_owned())//into_string()
impl TryFrom<String> for Uri {
type Error = crate::Error;

fn try_from(s: String) -> Result<Self, Self::Error> {
fluent_uri::Uri::parse_from(s).map_err(|(_,e)| e.into()).map(Uri)
}
}

impl ToString for Uri {
fn to_string(&self) -> String {
self.0.as_str().to_owned()//into_string()
}
}

Expand Down
16 changes: 12 additions & 4 deletions cdevents-sdk/src/uri_reference.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::fmt::Display;
use std::str::FromStr;

use serde::{Serialize, Deserialize};
Expand Down Expand Up @@ -42,9 +41,17 @@ impl TryFrom<&str> for UriReference {
}
}

impl Display for UriReference {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0.as_str().to_owned())//into_string()
impl TryFrom<String> for UriReference {
type Error = crate::Error;

fn try_from(s: String) -> Result<Self, Self::Error> {
fluent_uri::Uri::parse_from(s).map_err(|(_,e)| e.into()).map(UriReference)
}
}

impl ToString for UriReference {
fn to_string(&self) -> String {
self.0.as_str().to_owned()//into_string()
}
}

Expand All @@ -64,6 +71,7 @@ impl UriReference {
impl<> proptest::arbitrary::Arbitrary for UriReference {
type Parameters = ();
type Strategy = proptest::strategy::BoxedStrategy<Self>;

fn arbitrary_with(_args: Self::Parameters) -> Self::Strategy {
use proptest::prelude::*;
(prop_oneof![
Expand Down

0 comments on commit 965cf4a

Please sign in to comment.