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

174 Use Clippy CLI instead of github Action #175

Merged
merged 4 commits into from
Sep 2, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,9 @@ jobs:
- name: Cargo build
run: cargo build --verbose --locked --release
working-directory: ${{ env.SOURCE_PATH }}
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --workspace --all-targets --manifest-path "${{ env.SOURCE_PATH }}/Cargo.toml"
- name: Clippy
run: cargo clippy --all-features --workspace --all-targets -- -D warnings
working-directory: ${{ env.SOURCE_PATH }}
- name: Run tests
run: cargo test --verbose --locked --release --no-fail-fast
working-directory: ${{ env.SOURCE_PATH }}
Expand Down
4 changes: 2 additions & 2 deletions cube_shuffle-cli/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn to_string<O>(format: Formats, output_data: O) -> String
where
O: Debug + Serialize,
{
return match format {
match format {
Formats::Debug => {
format!("{:?}", output_data)
}
Expand All @@ -24,5 +24,5 @@ where
}
Formats::Json => serde_json::to_string(&output_data).unwrap(),
Formats::Yaml => serde_yaml::to_string(&output_data).unwrap(),
};
}
}
4 changes: 2 additions & 2 deletions cube_shuffle-core/src/distribution_shuffle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ pub struct Pile {
pub randomness: Odds,
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct Pack<P>
where
P: Hash + Eq + Serialize,
{
pub card_sources: HashMap<P, usize>,
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum ShufflingErrors {
EmptyPacks,
CardOverflow {
Expand Down
4 changes: 2 additions & 2 deletions cube_shuffle-wasm/src/components/add_pile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl Component for AddPile {
let update_cards = ctx.link().callback(Msg::UpdateCards);
let update_randomness = ctx.link().callback(Msg::UpdateRandomness);
let submit = ctx.link().callback(|_| Msg::Add);
return html! {
html! {
<>
<div class="field">
<label class="label">{ "Pile name" }</label>
Expand Down Expand Up @@ -118,6 +118,6 @@ impl Component for AddPile {
</div>
</div>
</>
};
}
}
}
10 changes: 5 additions & 5 deletions cube_shuffle-wasm/src/components/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub enum Msg {
Error(Option<String>),
}

#[derive(Clone, PartialEq)]
#[derive(Clone, PartialEq, Eq)]
pub enum State {
Piling,
Shuffled { packs: Vec<Pack<String>> },
Expand Down Expand Up @@ -224,15 +224,15 @@ impl Component for App {

let clear_error = link.callback(|_| Msg::Error(None));
let error_html: Html = self.error_message.clone().map_or(html! {}, |e| {
return html! {
html! {
<div class="notification is-danger">
<button onclick={ clear_error } class="delete"></button>
<p>{ e }</p>
</div>
};
}
});

return html! {
html! {
<>
<section class="section has-background-black-ter">
<div class="container">
Expand All @@ -249,7 +249,7 @@ impl Component for App {
{ error_html }
{ content }
</>
};
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions cube_shuffle-wasm/src/components/pack_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Component for PackCard {
}
};

return html! {
html! {
<div class="card">
<div class={ "card-header".to_owned() + checked_bg }>
<label class="label card-header-title">{ props.index + 1 }</label>
Expand All @@ -85,6 +85,6 @@ impl Component for PackCard {
</table>
</div>
</div>
};
}
}
}
6 changes: 3 additions & 3 deletions cube_shuffle-wasm/src/components/pack_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use cube_shuffle_core::distribution_shuffle::Pack;

use crate::components::pack_card::PackCard;

#[derive(Clone, PartialEq, Properties)]
#[derive(Clone, PartialEq, Eq, Properties)]
pub struct Props {
pub packs: Vec<Pack<String>>,
}
Expand Down Expand Up @@ -70,10 +70,10 @@ impl Component for PackList {
}
})
.collect();
return html! {
html! {
<div class="columns is-multiline is-centered">
{ packs }
</div>
};
}
}
}
4 changes: 2 additions & 2 deletions cube_shuffle-wasm/src/components/pile_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Component for PileCard {
let delete = ctx.link().callback(|_| Msg::Delete);
let pile = props.pile;
let randomness = pile.randomness * 100.0;
return html! {
html! {
<article class="message is-medium">
<div class="message-header">
<label>{ props.name.clone() }</label>
Expand All @@ -59,6 +59,6 @@ impl Component for PileCard {
</table>
</div>
</article>
};
}
}
}
8 changes: 4 additions & 4 deletions cube_shuffle-wasm/src/components/pile_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ pub fn pile_card(props: &Props) -> Html {
.piles
.iter()
.map(|(name, pile)| {
return html! {
html! {
<div class="column is-narrow">
<PileCard
name={ name.clone() }
pile={ *pile }
delete={ &props.delete_pile }
/>
</div>
};
}
})
.collect();

return html! {
html! {
<div class="columns is-multiline is-centered">
{ cards }
</div>
};
}
}