Skip to content

Commit

Permalink
New top-block
Browse files Browse the repository at this point in the history
• Get rid of the crate_name attributes
• Use new set of warnings
• Mark lifetimes in Display
  • Loading branch information
ogham committed Apr 26, 2020
1 parent 60aa897 commit dd46547
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#![crate_name = "term_grid"]
#![crate_type = "rlib"]
#![crate_type = "dylib"]

#![deny(unsafe_code)]

#![warn(future_incompatible)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
#![warn(missing_docs)]
#![warn(trivial_numeric_casts)]
#![warn(unreachable_pub)]
#![warn(unused_results)]
#![warn(nonstandard_style)]
#![warn(rust_2018_compatibility)]
#![warn(rust_2018_idioms)]
#![warn(trivial_casts, trivial_numeric_casts)]
#![warn(unused)]

#![deny(unsafe_code)]


//! This library arranges textual data in a grid format suitable for
Expand Down Expand Up @@ -295,7 +293,7 @@ impl Grid {
///
/// Returns `None` if any of the cells has a width greater than the
/// maximum width.
pub fn fit_into_width(&self, maximum_width: Width) -> Option<Display> {
pub fn fit_into_width(&self, maximum_width: Width) -> Option<Display<'_>> {
self.width_dimensions(maximum_width)
.map(|dims| Display {
grid: self,
Expand All @@ -305,7 +303,7 @@ impl Grid {

/// Returns a displayable grid with the given number of columns, and no
/// maximum width.
pub fn fit_into_columns(&self, num_columns: usize) -> Display {
pub fn fit_into_columns(&self, num_columns: usize) -> Display<'_> {
Display {
grid: self,
dimensions: self.columns_dimensions(num_columns),
Expand Down Expand Up @@ -440,7 +438,7 @@ pub struct Display<'grid> {
dimensions: Dimensions,
}

impl<'grid> Display<'grid> {
impl Display<'_> {

/// Returns how many columns this display takes up, based on the separator
/// width and the number and width of the columns.
Expand All @@ -465,8 +463,8 @@ impl<'grid> Display<'grid> {
}
}

impl<'grid> fmt::Display for Display<'grid> {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
impl fmt::Display for Display<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
for y in 0 .. self.dimensions.num_lines {
for x in 0 .. self.dimensions.widths.len() {
let num = match self.grid.options.direction {
Expand Down

0 comments on commit dd46547

Please sign in to comment.