Skip to content

Commit

Permalink
formatting, clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
ranile committed Nov 12, 2020
1 parent 0a96f42 commit 1d74305
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 36 deletions.
59 changes: 33 additions & 26 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
name: Lint
on:
push:
branches: [ master ]
push:
branches: [master]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
components: rustfmt, clippy
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
components: rustfmt, clippy

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
cargo-${{ runner.os }}-
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
toolchain: nightly
args: --all -- --check
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
toolchain: nightly
args: --all -- --check

- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
toolchain: nightly
args: --all-features -- -D warnings
2 changes: 2 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://github.com/rust-lang/rust-clippy/issues/6327
unused-imports = true
2 changes: 1 addition & 1 deletion yew-material/src/dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ loader_hack!(Dialog);
///
/// ## Actions
///
/// In order to pass actions, [`super::MatDialogAction`] component should be
/// In order to pass actions, [`MatDialogAction`] component should be
/// used.
pub struct MatDialog {
props: Props,
Expand Down
3 changes: 2 additions & 1 deletion yew-material/src/dialog/dialog_action.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use yew::prelude::*;
use crate::MatDialog;

#[derive(Clone)]
pub enum ActionType {
Expand Down Expand Up @@ -26,7 +27,7 @@ pub struct ActionProps {
pub children: Children,
}

/// Defines actions for [`super::MatDialog`].
/// Defines actions for [`MatDialog`].
///
/// If the child passed is an element (a `VTag`), then it is modified to include
/// the appropriate attributes. Otherwise, the child is wrapped in a `span`
Expand Down
3 changes: 2 additions & 1 deletion yew-material/src/drawer/drawer_app_content.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use yew::prelude::*;
use crate::MatDrawer;

const SLOT: &str = "appContent";

Expand All @@ -7,7 +8,7 @@ pub struct Props {
pub children: Children,
}

/// Defines `appContent` for [`super::MatDrawer`].
/// Defines `appContent` for [`MatDrawer`].
///
/// If the child passed is an element (a `VTag`), then it is modified to include
/// the appropriate attributes. Otherwise, the child is wrapped in a `span`
Expand Down
3 changes: 2 additions & 1 deletion yew-material/src/drawer/drawer_header.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use yew::prelude::*;
use crate::MatDrawer;

const SLOT: &str = "header";

Expand All @@ -7,7 +8,7 @@ pub struct Props {
pub children: Children,
}

/// Defines header for [`super::MatDrawer`].
/// Defines header for [`MatDrawer`].
///
/// If the child passed is an element (a `VTag`), then it is modified to include
/// the appropriate attributes. Otherwise, the child is wrapped in a `span`
Expand Down
3 changes: 2 additions & 1 deletion yew-material/src/drawer/drawer_subtitle.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use yew::prelude::*;
use crate::MatDrawer;

const SLOT: &str = "subtitle";

Expand All @@ -7,7 +8,7 @@ pub struct Props {
pub children: Children,
}

/// Defines sub title for [`super::MatDrawer`].
/// Defines sub title for [`MatDrawer`].
///
/// If the child passed is an element (a `VTag`), then it is modified to include
/// the appropriate attributes. Otherwise, the child is wrapped in a `span`
Expand Down
3 changes: 2 additions & 1 deletion yew-material/src/drawer/drawer_title.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use yew::prelude::*;
use crate::MatDrawer;

const SLOT: &str = "title";

Expand All @@ -7,7 +8,7 @@ pub struct Props {
pub children: Children,
}

/// Defines title for [`super::MatDrawer`].
/// Defines title for [`MatDrawer`].
///
/// If the child passed is an element (a `VTag`), then it is modified to include
/// the appropriate attributes. Otherwise, the child is wrapped in a `span`
Expand Down
3 changes: 2 additions & 1 deletion yew-material/src/icon_button_toggle/on_icon.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use yew::prelude::*;
use crate::MatIconButtonToggle;

const SLOT: &str = "onIcon";

Expand All @@ -7,7 +8,7 @@ pub struct Props {
pub children: Children,
}

/// Defines header for [`super::MatIconButtonToggle`].
/// Defines header for [`MatIconButtonToggle`].
///
/// If the child passed is an element (a `VTag`), then it is modified to include
/// the appropriate attributes. Otherwise, the child is wrapped in a `span`
Expand Down
7 changes: 4 additions & 3 deletions yew-material/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! A Material components library for [Yew](https://yew.rs). It wrpas around [Material Web Components](https://github.com/material-components/material-components-web-components) exposing Yew components
//! A Material components library for [Yew](https://yew.rs). It wrpas around [Material Web Components](https://github.com/material-components/material-components-web-components) exposing Yew components.
//!
//! Example usage:
//! ```rust
Expand Down Expand Up @@ -26,8 +26,10 @@ mod utils;
// this macro is defined here so we can access it in the modules
macro_rules! loader_hack {
($ty:ty) => {
#[allow(dead_code)]
static LOADED: std::sync::Once = std::sync::Once::new();
impl $ty {
#[allow(dead_code)]
fn ensure_loaded() {
LOADED.call_once(|| {
<$ty>::_dummy_loader();
Expand All @@ -39,8 +41,7 @@ macro_rules! loader_hack {

macro_rules! component {
($comp: ident, $props: ty, $html: expr, $mwc_to_initialize: ident, $mwc_name: literal) => {
use paste::paste;
paste! {
paste::paste! {
#[doc = "The `mwc-" $mwc_name "` component"]
#[doc = ""]
#[doc = "[MWC Documentation](https://github.com/material-components/material-components-web-components/tree/master/packages/"$mwc_name")"]
Expand Down

0 comments on commit 1d74305

Please sign in to comment.