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

remove cargo build warnings and some clippy warnings; cargo fmt #351

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ Cargo.lock
.vscode/launch.json
manual/book/*
dependency_order.md
**/nohup.out
2 changes: 1 addition & 1 deletion bracket-bevy/src/builder/bterm_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
};
use bevy::{
diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin},
prelude::{CoreStage, Plugin, SystemStage, Resource},
prelude::{CoreStage, Plugin, Resource, SystemStage},
utils::HashMap,
};
use bracket_color::prelude::RGBA;
Expand Down
2 changes: 1 addition & 1 deletion bracket-bevy/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
fonts::FontStore,
FontCharType, TerminalScalingMode,
};
use bevy::{sprite::Mesh2dHandle, utils::HashMap, prelude::Resource};
use bevy::{prelude::Resource, sprite::Mesh2dHandle, utils::HashMap};
use bracket_color::prelude::RGBA;
use bracket_geometry::prelude::{Point, Rect};
use parking_lot::Mutex;
Expand Down
4 changes: 2 additions & 2 deletions bracket-color/src/color_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ impl ColorPair {
#[inline]
#[must_use]
/// Creates a new `ColorPair`, from two given colors.
///
///
/// # Arguments
///
///
/// * `fg` - The foreground color to use.
/// * `bg` - The background color to use.
pub fn new<COLOR, COLOR2>(fg: COLOR, bg: COLOR2) -> Self
Expand Down
12 changes: 6 additions & 6 deletions bracket-color/src/hsv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ impl HSV {
}

/// Constructs a new HSV color, from 3 32-bit floats
///
///
/// # Arguments
///
///
/// * `h` - The hue (0..1) to use.
/// * `s` - The saturation (0..1) to use.
/// * `v` - The value (0..1) to use.
Expand Down Expand Up @@ -120,14 +120,14 @@ impl HSV {
}

/// Progress smoothly between two colors, in the HSV color space.
///
///
/// # Arguments
///
///
/// * `color` - the target color.
/// * `percent` - the percentage (0..1) of the starting (self) and target color to use.
///
///
/// # Example
///
///
/// ```rust
/// use bracket_color::prelude::*;
/// let red = RGB::named(RED);
Expand Down
8 changes: 4 additions & 4 deletions bracket-color/src/lerpit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ pub struct RgbLerp {
impl RgbLerp {
/// Creates a new RGB lerp iterator. The iterator smoothly transitions between two colors,
/// using the specified number of steps.
///
///
/// # Arguments
///
///
/// * `start` - the color to start from.
/// * `end` - the color to end at on the final step.
/// * `steps` - number of steps to iterate between the start and end colors.
///
///
/// # Example
///
///
/// ```rust
/// use bracket_color::prelude::*;
/// for color in RgbLerp::new(RGB::named(RED), RGB::named(YELLOW), 20) {
Expand Down
16 changes: 8 additions & 8 deletions bracket-color/src/palette.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ lazy_static! {
}

/// Register a palette color by name with the global registry.
///
///
/// # Arguments
///
///
/// * `name` - the name of the color to register.
/// * `color` - a bracket-lib compatible color to associate with the name.
///
///
/// # Example
///
///
/// ```rust
/// use bracket_color::prelude::*;
/// register_palette_color("red", RED);
Expand All @@ -27,13 +27,13 @@ pub fn register_palette_color<S: ToString, COLOR: Into<RGBA>>(name: S, color: CO

/// Retrieve a palette color by name from the global registry.
/// Returns `Some(RGBA)` if the color is registered, `None` if it is not.
///
///
/// # Arguments
///
///
/// * `name` - the requested name.
///
///
/// # Example
///
///
/// ```rust
/// use bracket_color::prelude::*;
/// register_palette_color("red", RED);
Expand Down
34 changes: 17 additions & 17 deletions bracket-color/src/rgb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ impl RGB {
}

/// Constructs a new RGB color, from 3 32-bit floats in the range 0..1
///
///
/// # Arguments
///
///
/// * `r` - the red component (0..1)
/// * `g` - the green component (0..1)
/// * `b` - the blue component (0..1)
///
///
/// # Example
///
///
/// ```rust
/// use bracket_color::prelude::*;
/// let red = RGB::from_f32(1.0, 0.0, 0.0);
Expand All @@ -175,15 +175,15 @@ impl RGB {
}

/// Constructs a new RGB color, from 3 bytes in the range 0..255
///
///
/// # Arguments
///
///
/// * `r` - the red component, ranged from 0 to 255
/// * `g` - the green component, ranged from 0 to 255
/// * `b` - the blue component, ranged from 0 to 255
///
///
/// # Example
///
///
/// ```rust
/// use bracket_color::prelude::*;
/// let red = RGB::from_u8(255, 0, 0);
Expand All @@ -200,13 +200,13 @@ impl RGB {
}

/// Construct an RGB color from a tuple of u8, or a named constant
///
///
/// # Arguments
///
///
/// * `col` a tuple of three `u8` values. See `from_u8`. These are usually provided from the `named` colors list.
///
///
/// # Example
///
///
/// ```rust
/// use bracket_color::prelude::*;
/// let red = RGB::named(RED);
Expand All @@ -219,21 +219,21 @@ impl RGB {
}

/// Constructs from an HTML color code (e.g. "#eeffee")
///
///
/// # Arguments
///
///
/// * `code` - an HTML color notation (e.g. "#ffeeff")
///
///
/// # Example
///
///
/// ```rust
/// use bracket_color::prelude::*;
/// let red = RGB::from_hex("#FF0000");
/// let green = RGB::from_hex("#00FF00");
/// ```
///
/// # Errors
///
///
/// See `HtmlColorConversionError`
#[allow(clippy::cast_precision_loss)]
pub fn from_hex<S: AsRef<str>>(code: S) -> Result<Self, HtmlColorConversionError> {
Expand Down
32 changes: 16 additions & 16 deletions bracket-color/src/rgba.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ impl RGBA {
}

/// Constructs a new RGB color, from 3 32-bit floats in the range 0..1
///
///
/// # Arguments
///
///
/// * `r` - the red component (0..1)
/// * `g` - the green component (0..1)
/// * `b` - the blue component (0..1)
/// * `a` - the alpha component (0..1). 0 is transparent, 1 is solid.
///
///
/// # Example
///
///
/// ```rust
/// use bracket_color::prelude::*;
/// let red = RGBA::from_f32(1.0, 0.0, 0.0, 1.0);
Expand All @@ -141,15 +141,15 @@ impl RGBA {
}

/// Constructs a new RGB color, from 3 bytes in the range 0..255
///
///
/// # Arguments
///
///
/// * `r` - the red component, ranged from 0 to 255
/// * `g` - the green component, ranged from 0 to 255
/// * `b` - the blue component, ranged from 0 to 255
///
///
/// # Example
///
///
/// ```rust
/// use bracket_color::prelude::*;
/// let red = RGBA::from_u8(255, 0, 0, 255);
Expand All @@ -168,13 +168,13 @@ impl RGBA {
}

/// Construct an RGB color from a tuple of u8, or a named constant
///
///
/// # Arguments
///
///
/// * `col` a tuple of three `u8` values. See `from_u8`. These are usually provided from the `named` colors list.
///
///
/// # Example
///
///
/// ```rust
/// use bracket_color::prelude::*;
/// let red = RGBA::named(RED);
Expand All @@ -189,19 +189,19 @@ impl RGBA {
/// Constructs from an HTML color code (e.g. "#eeffeeff")
///
/// # Arguments
///
///
/// * `code` - an HTML color notation (e.g. "#ffeeffff")
///
///
/// # Example
///
///
/// ```rust
/// use bracket_color::prelude::*;
/// let red = RGBA::from_hex("#FF0000FF");
/// let green = RGBA::from_hex("#00FF00FF");
/// ```
///
/// # Errors
///
///
/// See `HtmlColorConversionError`
#[allow(clippy::cast_precision_loss)]
pub fn from_hex<S: AsRef<str>>(code: S) -> Result<Self, HtmlColorConversionError> {
Expand Down
5 changes: 2 additions & 3 deletions bracket-embedding/src/embedding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use parking_lot::Mutex;
use std::collections::HashMap;

// These are included by default in `bracket-terminal`.
const TERMINAL_8_8_BYTES: &[u8] =
include_bytes!("../resources/terminal8x8.png");
const TERMINAL_8_8_BYTES: &[u8] = include_bytes!("../resources/terminal8x8.png");
const TERMINAL_8_16_BYTES: &[u8] = include_bytes!("../resources/vga8x16.png");

lazy_static! {
Expand Down Expand Up @@ -33,7 +32,7 @@ impl Dictionary {
#[must_use]
pub fn get_resource(&self, path: String) -> Option<&'static [u8]> {
let fixed_path = if std::path::MAIN_SEPARATOR == '/' {
path
path
} else {
path.replace(std::path::MAIN_SEPARATOR, "/")
};
Expand Down
38 changes: 19 additions & 19 deletions bracket-embedding/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
//! The `bracket-embedding` crate is used to provide resource embedding.
//! This allows you to include binary assets inside your program when shipping,
//! with no external files. This can be especially useful for WASM builds.
//!
//!
//! For example:
//!
//!
//! ```rust
//! use bracket_embedding::prelude::*;
//!
//!
//! embedded_resource!(SOURCE_FILE, "embedding.rs");
//!
//!
//! fn main() {
//! // This helper macro links the above embedding, allowing it to be accessed as a resource from various parts of the program.
//! link_resource!(SOURCE_FILE, "embedding.rs");
//! }
//! ```
//!
//!
//! This crate isn't very useful on its own, but is heavily used by the other parts of `bracket-lib`.

#![warn(clippy::all, clippy::pedantic, clippy::cargo)]
Expand All @@ -27,21 +27,21 @@ pub mod prelude {
}

/// Declare an embedded resource.
///
///
/// # Arguments
///
///
/// * `resource_name` - a constant that will represent the resource.
/// * `filename` - the path to the file to embed.
///
///
/// Once embedded, you need to use `link_resource` to make it available.
///
///
/// # Example
///
///
/// ```rust
/// use bracket_embedding::prelude::*;
///
///
/// embedded_resource!(SOURCE_FILE, "embedding.rs");
///
///
/// fn main() {
/// // This helper macro links the above embedding, allowing it to be accessed as a resource from various parts of the program.
/// link_resource!(SOURCE_FILE, "embedding.rs");
Expand All @@ -56,21 +56,21 @@ macro_rules! embedded_resource {

/// Link an embedded resource, making it available to `bracket-lib` via the resources
/// system.
///
///
/// # Arguments
///
///
/// * `resource_name` - a constant that will represent the resource.
/// * `filename` - the path to the file to embed.
///
///
/// The resource must be previously declared with `embedded_resource!`.
///
///
/// # Example
///
///
/// ```rust
/// use bracket_embedding::prelude::*;
///
///
/// embedded_resource!(SOURCE_FILE, "embedding.rs");
///
///
/// fn main() {
/// // This helper macro links the above embedding, allowing it to be accessed as a resource from various parts of the program.
/// link_resource!(SOURCE_FILE, "embedding.rs");
Expand Down
Loading