Skip to content

Commit

Permalink
rustfmt: inline_attribute_width = 60
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Oct 8, 2022
1 parent 1b53022 commit a807a8a
Show file tree
Hide file tree
Showing 28 changed files with 43 additions and 84 deletions.
1 change: 1 addition & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This may be useful to run occasionally, but has issues:
#format_code_in_doc_comments = true

inline_attribute_width = 60
use_field_init_shorthand = true
use_try_shorthand = true
6 changes: 2 additions & 4 deletions crates/kas-core/src/core/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@

//! Widget data types

#[allow(unused)]
use super::Layout;
#[allow(unused)] use super::Layout;
use super::{Widget, WidgetId};
use crate::dir::Direction;
use crate::event::EventMgr;
use crate::geom::Rect;

#[cfg(feature = "winit")]
pub use winit::window::Icon;
#[cfg(feature = "winit")] pub use winit::window::Icon;

/// An icon used for the window titlebar, taskbar, etc.
#[cfg(not(feature = "winit"))]
Expand Down
9 changes: 3 additions & 6 deletions crates/kas-core/src/core/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ use crate::util::IdentifyWidget;
use crate::WidgetId;
use kas_macros::autoimpl;

#[allow(unused)]
use crate::event::EventState;
#[allow(unused)] use crate::event::EventState;
#[allow(unused)]
use crate::layout::{self, AlignPair, AutoLayout};
#[allow(unused)]
use crate::TkAction;
#[allow(unused)]
use kas_macros as macros;
#[allow(unused)] use crate::TkAction;
#[allow(unused)] use kas_macros as macros;

/// Base functionality for [`Widget`]s
///
Expand Down
6 changes: 2 additions & 4 deletions crates/kas-core/src/draw/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
//! Drawing APIs — draw interface

use super::{color::Rgba, AnimationState};
#[allow(unused)]
use super::{DrawRounded, DrawRoundedImpl};
#[allow(unused)] use super::{DrawRounded, DrawRoundedImpl};
use super::{DrawShared, DrawSharedImpl, ImageId, PassId, PassType, SharedState};
use crate::geom::{Offset, Quad, Rect};
#[allow(unused)]
use crate::text::TextApi;
#[allow(unused)] use crate::text::TextApi;
use crate::text::{Effect, TextDisplay};
use std::any::Any;
use std::time::Instant;
Expand Down
6 changes: 2 additions & 4 deletions crates/kas-core/src/draw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@

pub mod color;

#[allow(clippy::module_inception)]
mod draw;
#[allow(clippy::module_inception)] mod draw;
mod draw_rounded;
mod draw_shared;

use crate::cast::Cast;
#[allow(unused)]
use crate::theme::DrawMgr;
#[allow(unused)] use crate::theme::DrawMgr;

pub use draw::{Draw, DrawIface, DrawImpl};
pub use draw_rounded::{DrawRounded, DrawRoundedImpl};
Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/event/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use super::ScrollDelta::{LineDelta, PixelDelta};
use super::{Command, CursorIcon, Event, EventMgr, PressSource, Response, Scroll};
use crate::cast::traits::*;
use crate::geom::{Coord, Offset, Rect, Size, Vec2};
#[allow(unused)]
use crate::text::SelectionHelper;
#[allow(unused)] use crate::text::SelectionHelper;
use crate::{TkAction, WidgetId};
use kas_macros::impl_default;
use std::time::{Duration, Instant};
Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/event/config/shortcuts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ use serde::de::{self, Deserialize, Deserializer, MapAccess, Unexpected, Visitor}
#[cfg(feature = "config")]
use serde::ser::{Serialize, SerializeMap, Serializer};
use std::collections::HashMap;
#[cfg(feature = "config")]
use std::fmt;
#[cfg(feature = "config")] use std::fmt;

/// Shortcut manager
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/event/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ use serde::{Deserialize, Serialize};
use super::{EventMgr, EventState, GrabMode, Response}; // for doc-links
use super::{MouseButton, UpdateId, VirtualKeyCode};
use crate::geom::{Coord, DVec2, Offset};
#[allow(unused)]
use crate::Widget;
#[allow(unused)] use crate::Widget;
use crate::{dir::Direction, WidgetId, WindowId};

/// Events addressed to a widget
Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/event/manager/config_mgr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ use crate::theme::{Feature, SizeMgr, TextClass, ThemeSize};
use crate::{TkAction, Widget, WidgetExt, WidgetId};
use std::ops::{Deref, DerefMut};

#[allow(unused)]
use crate::{event::Event, Layout};
#[allow(unused)] use crate::{event::Event, Layout};

/// Manager used to configure widgets and layout
///
Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/event/manager/mgr_pub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use crate::cast::Conv;
use crate::draw::DrawShared;
use crate::geom::{Coord, Offset, Vec2};
use crate::theme::{SizeMgr, ThemeControl};
#[allow(unused)]
use crate::{Layout, Widget}; // for doc-links
#[allow(unused)] use crate::{Layout, Widget}; // for doc-links
use crate::{TkAction, WidgetId, WindowId};

impl<'a> std::ops::BitOrAssign<TkAction> for EventMgr<'a> {
Expand Down
12 changes: 4 additions & 8 deletions crates/kas-core/src/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@
//! [`Unused`]: Response::Unused

pub mod config;
#[cfg(not(feature = "winit"))]
mod enums;
#[cfg(not(feature = "winit"))] mod enums;
mod events;
mod manager;
mod response;
Expand All @@ -68,13 +67,10 @@ use std::fmt::Debug;

#[cfg(feature = "winit")]
pub use winit::event::{ModifiersState, MouseButton, VirtualKeyCode};
#[cfg(feature = "winit")]
pub use winit::window::CursorIcon;
#[cfg(feature = "winit")] pub use winit::window::CursorIcon;

#[allow(unused)]
use crate::Widget;
#[doc(no_inline)]
pub use config::Config;
#[allow(unused)] use crate::Widget;
#[doc(no_inline)] pub use config::Config;
#[cfg(not(feature = "winit"))]
pub use enums::{CursorIcon, ModifiersState, MouseButton, VirtualKeyCode};
pub use events::*;
Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/layout/align.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

//! Alignment types

#[allow(unused)]
use super::Stretch; // for doc-links
#[allow(unused)] use super::Stretch; // for doc-links
use crate::dir::Directional;
use crate::geom::{Rect, Size};

Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ use crate::geom::{Coord, Rect};
use crate::theme::{DrawMgr, SizeMgr};
use crate::WidgetId;

#[allow(unused)]
use crate::Layout;
#[allow(unused)] use crate::Layout;

pub use align::{Align, AlignHints, AlignPair};
pub use grid_solver::{DefaultWithLen, GridChildInfo, GridDimensions, GridSetter, GridSolver};
Expand Down
6 changes: 2 additions & 4 deletions crates/kas-core/src/layout/size_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ use crate::dir::Directional;
use crate::geom::Size;

// for doc use
#[allow(unused)]
use super::FrameRules;
#[allow(unused)]
use crate::theme::SizeMgr;
#[allow(unused)] use super::FrameRules;
#[allow(unused)] use crate::theme::SizeMgr;

/// Widget sizing information
///
Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/layout/size_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ use crate::theme::MarginStyle;
use kas_macros::impl_scope;

// for doc use
#[allow(unused)]
use crate::theme::SizeMgr;
#[allow(unused)] use crate::theme::SizeMgr;

/// Logical (pre-scaling) pixel size
///
Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@

extern crate self as kas;

#[macro_use]
extern crate bitflags;
#[macro_use] extern crate bitflags;

pub extern crate easy_cast as cast;
pub extern crate kas_macros as macros;
Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/model/shared_arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

//! `SharedArc` data type

#[allow(unused)]
use crate::event::Event;
#[allow(unused)] use crate::event::Event;
use crate::event::{EventMgr, UpdateId};
use crate::model::*;
use std::fmt::Debug;
Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/model/shared_rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

//! `SharedRc` data type

#[allow(unused)]
use crate::event::Event;
#[allow(unused)] use crate::event::Event;
use crate::event::{EventMgr, UpdateId};
use crate::model::*;
use std::cell::{Ref, RefCell, RefMut};
Expand Down
18 changes: 6 additions & 12 deletions crates/kas-core/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
//! It is recommended to use `kas::prelude` instead, which is an extension of
//! this crate's prelude.

#[doc(no_inline)]
pub use crate::cast::traits::*;
#[doc(no_inline)]
pub use crate::class::*;
#[doc(no_inline)] pub use crate::cast::traits::*;
#[doc(no_inline)] pub use crate::class::*;
#[doc(no_inline)]
pub use crate::dir::{Direction, Directional};
#[doc(no_inline)]
Expand All @@ -22,16 +20,12 @@ pub use crate::geom::{Coord, Offset, Rect, Size};
pub use crate::layout::{Align, AlignPair, AxisInfo, SizeRules, Stretch};
#[doc(no_inline)]
pub use crate::macros::{autoimpl, impl_default, impl_scope, singleton, widget, widget_index};
#[doc(no_inline)]
pub use crate::text::AccelString;
#[doc(no_inline)] pub use crate::text::AccelString;
#[doc(no_inline)]
pub use crate::text::{EditableTextApi, Text, TextApi, TextApiExt};
#[doc(no_inline)]
pub use crate::theme::{DrawMgr, SizeMgr};
#[doc(no_inline)]
pub use crate::TkAction;
#[doc(no_inline)]
pub use crate::WidgetId;
#[doc(no_inline)] pub use crate::theme::{DrawMgr, SizeMgr};
#[doc(no_inline)] pub use crate::TkAction;
#[doc(no_inline)] pub use crate::WidgetId;
#[doc(no_inline)]
pub use crate::{HasScrollBars, ScrollBarMode, Scrollable};
#[doc(no_inline)]
Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
//!
//! [KAS Text]: https://github.com/kas-gui/kas-text/

#[allow(unused)]
use kas::{event::ConfigMgr, Layout};
#[allow(unused)] use kas::{event::ConfigMgr, Layout};

pub use kas_text::*;

Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/theme/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ pub use draw::{Background, DrawMgr, ThemeDraw};
pub use size::{SizeMgr, ThemeSize};
pub use style::*;

#[allow(unused)]
use crate::event::EventMgr;
#[allow(unused)] use crate::event::EventMgr;
use crate::TkAction;
use std::ops::{Deref, DerefMut};

Expand Down
3 changes: 1 addition & 2 deletions crates/kas-core/src/theme/size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ use crate::layout::{AlignPair, AxisInfo, FrameRules, Margins, SizeRules};
use crate::macros::autoimpl;
use crate::text::TextApi;

#[allow(unused)]
use crate::text::TextApiExt;
#[allow(unused)] use crate::text::TextApiExt;
#[allow(unused)]
use crate::{event::ConfigMgr, layout::Stretch, theme::DrawMgr};

Expand Down
3 changes: 1 addition & 2 deletions crates/kas-dylib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#![allow(clippy::single_component_path_imports)]

use kas_core;
#[cfg(feature = "kas-resvg")]
use kas_resvg;
#[cfg(feature = "kas-resvg")] use kas_resvg;
use kas_theme;
use kas_wgpu;
use kas_widgets;
6 changes: 2 additions & 4 deletions crates/kas-resvg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ pub extern crate tiny_skia;
mod canvas;
pub use canvas::{Canvas, CanvasProgram};

#[cfg(feature = "svg")]
mod svg;
#[cfg(feature = "svg")]
pub use svg::Svg;
#[cfg(feature = "svg")] mod svg;
#[cfg(feature = "svg")] pub use svg::Svg;
3 changes: 1 addition & 2 deletions crates/kas-view/src/list_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use super::{driver, Driver, PressPhase, SelectionError, SelectionMode, Selection
use kas::event::components::ScrollComponent;
use kas::event::{Command, CursorIcon, Scroll};
use kas::layout::{solve_size_rules, AlignHints};
#[allow(unused)]
use kas::model::SharedData;
#[allow(unused)] use kas::model::SharedData;
use kas::model::{ListData, SharedDataMut};
use kas::prelude::*;
#[allow(unused)] // doc links
Expand Down
3 changes: 1 addition & 2 deletions crates/kas-view/src/matrix_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use super::{driver, Driver, PressPhase, SelectionError, SelectionMode, Selection
use kas::event::components::ScrollComponent;
use kas::event::{Command, CursorIcon, Scroll};
use kas::layout::{solve_size_rules, AlignHints};
#[allow(unused)]
use kas::model::SharedData;
#[allow(unused)] use kas::model::SharedData;
use kas::model::{MatrixData, SharedDataMut};
use kas::prelude::*;
#[allow(unused)] // doc links
Expand Down
3 changes: 1 addition & 2 deletions crates/kas-widgets/src/adapter/adapt_widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ use kas::geom::Vec2;
use kas::layout::{AxisInfo, SizeRules};
use kas::text::AccelString;
use kas::theme::SizeMgr;
#[allow(unused)]
use kas::Layout;
#[allow(unused)] use kas::Layout;
use kas::Widget;
use std::fmt::Debug;

Expand Down
3 changes: 1 addition & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ pub mod prelude {

pub use kas_core::*;

#[doc(inline)]
pub extern crate kas_widgets as widgets;
#[doc(inline)] pub extern crate kas_widgets as widgets;

#[cfg(any(feature = "view"))]
#[cfg_attr(doc_cfg, doc(cfg(feature = "view")))]
Expand Down

0 comments on commit a807a8a

Please sign in to comment.