From fb2f5853ad9823a6aa8018a2e5d5b96f9b34dbd5 Mon Sep 17 00:00:00 2001 From: Pierre-Henri Symoneaux Date: Sun, 25 Aug 2019 12:52:52 +0200 Subject: Updated to rust 2018 --- .travis.yml | 7 +++++++ Cargo.toml | 10 ++++++---- TODO.md | 12 ------------ examples/basic.rs | 4 +--- examples/csv.rs | 2 -- examples/formatting.rs | 4 +--- examples/multiline.rs | 4 +--- examples/slices.rs | 5 +---- examples/span.rs | 4 +--- examples/style.rs | 4 +--- examples/tictactoe.rs | 6 +----- src/cell.rs | 6 +++--- src/csv.rs | 4 ++-- src/lib.rs | 13 +++---------- src/main.rs | 4 +--- src/utils.rs | 2 +- 16 files changed, 30 insertions(+), 61 deletions(-) delete mode 100644 TODO.md diff --git a/.travis.yml b/.travis.yml index 2ac8945..ec95861 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,13 @@ language: rust rust: - 1.30.0 +- 1.31.0 +- 1.32.0 +- 1.33.0 +- 1.34.0 +- 1.35.0 +- 1.36.0 +- 1.37.0 - stable - beta - nightly diff --git a/Cargo.toml b/Cargo.toml index 942b589..46137d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ authors = [ "Pierre-Henri Symoneaux" ] keywords = ["tab", "table", "format", "pretty", "print"] categories = ["command-line-interface"] license = "BSD-3-Clause" +edition = "2018" [badges] appveyor = { repository = "phsym/prettytable-rs", branch = "master", service = "github" } @@ -23,15 +24,16 @@ win_crlf = [] [[bin]] name = "main" +edition = "2018" path = "src/main.rs" [lib] name = "prettytable" [dependencies] -unicode-width = "^0.1" -term = "^0.5" +unicode-width = "0.1" +term = "0.5" lazy_static = "1" -atty = "^0.2" -encode_unicode = "^0.3" +atty = "0.2" +encode_unicode = "0.3" csv = { version = "1", optional = true } diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 80bf07a..0000000 --- a/TODO.md +++ /dev/null @@ -1,12 +0,0 @@ -# TODO list - -## Features : -* Limit cell width and split content if needed -* Limit table width and auto adjust cell width as needed -* Add capability to prevent new lines in cell, by replacing them with spaces - -## Improvements : - -## General : - -## Travis-CI : diff --git a/examples/basic.rs b/examples/basic.rs index 1e5cf35..0bbab1f 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -1,6 +1,4 @@ -#[macro_use] -extern crate prettytable; -use prettytable::{Table, Row, Cell}; +use prettytable::{Table, Row, Cell, row, table, ptable}; /* Following main function will print : diff --git a/examples/csv.rs b/examples/csv.rs index 8dbaab1..4a94afb 100644 --- a/examples/csv.rs +++ b/examples/csv.rs @@ -1,5 +1,3 @@ -extern crate prettytable; - /* Following main function will print : +---------+------+---------+ diff --git a/examples/formatting.rs b/examples/formatting.rs index 7822866..e6e9aa0 100644 --- a/examples/formatting.rs +++ b/examples/formatting.rs @@ -1,6 +1,4 @@ -#[macro_use] -extern crate prettytable; -use prettytable::format; +use prettytable::{format, table, row}; fn main() { let mut table = table!(["Value 1", "Value 2"], ["Value three", "Value four"]); diff --git a/examples/multiline.rs b/examples/multiline.rs index a453255..143815d 100644 --- a/examples/multiline.rs +++ b/examples/multiline.rs @@ -1,6 +1,4 @@ -#[macro_use] -extern crate prettytable; - +use prettytable::table; /* Following main function will print : +-------------------------+------------------------------+ diff --git a/examples/slices.rs b/examples/slices.rs index e66ba36..9130718 100644 --- a/examples/slices.rs +++ b/examples/slices.rs @@ -1,7 +1,4 @@ -#[macro_use] -extern crate prettytable; - -use prettytable::Slice; +use prettytable::{Slice, table, row}; fn main() { let mut table = table![[0, 0, 0], [1, 1, 1], [2, 2, 2], [3, 3, 3], [4, 4, 4], [5, 5, 5]]; diff --git a/examples/span.rs b/examples/span.rs index 10f1ef7..5c3b4e2 100644 --- a/examples/span.rs +++ b/examples/span.rs @@ -1,6 +1,4 @@ -#[macro_use] -extern crate prettytable; -use prettytable::{Row, Cell, format::Alignment}; +use prettytable::{Row, Cell, format::Alignment, table}; fn main() { diff --git a/examples/style.rs b/examples/style.rs index 1d93e07..ad3c4e3 100644 --- a/examples/style.rs +++ b/examples/style.rs @@ -1,8 +1,6 @@ -#[macro_use] -extern crate prettytable; use prettytable::{Table, Row, Cell}; - use prettytable::{Attr, color}; +use prettytable::{table, row, cell, ptable}; #[allow(dead_code)] fn main() { diff --git a/examples/tictactoe.rs b/examples/tictactoe.rs index 727fc8e..0ff7207 100644 --- a/examples/tictactoe.rs +++ b/examples/tictactoe.rs @@ -1,8 +1,4 @@ -#[macro_use] -extern crate prettytable; -extern crate term; - -use prettytable::Table; +use prettytable::{Table, table, cell}; use std::io; use std::io::Write; diff --git a/src/cell.rs b/src/cell.rs index 61e71ca..795c4c7 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -320,10 +320,10 @@ macro_rules! cell { #[cfg(test)] mod tests { - use Cell; - use format::Alignment; + use super::Cell; + use crate::format::Alignment; use term::{color, Attr}; - use utils::StringWriter; + use crate::utils::StringWriter; #[test] fn get_content() { diff --git a/src/csv.rs b/src/csv.rs index 55f10e2..417e8e6 100644 --- a/src/csv.rs +++ b/src/csv.rs @@ -1,6 +1,6 @@ //! CSV impl and reexported types -extern crate csv; +use csv; pub use self::csv::{Reader, Writer, Result, ReaderBuilder}; use std::path::Path; @@ -81,7 +81,7 @@ impl super::Table { #[cfg(test)] mod tests { - use {Table, Row, Cell}; + use crate::{Table, Row, Cell}; static CSV_S: &'static str = "ABC,DEFG,HIJKLMN\n\ foobar,bar,foo\n\ diff --git a/src/lib.rs b/src/lib.rs index cc9dd0b..66daaf9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,12 +3,9 @@ unused_import_braces, unused_qualifications)] //! A formatted and aligned table printer written in rust -extern crate unicode_width; -extern crate term; -extern crate atty; +//! #[macro_use] extern crate lazy_static; -extern crate encode_unicode; use std::io::{self, Write, Error}; use std::fmt; @@ -587,13 +584,9 @@ macro_rules! ptable { #[cfg(test)] mod tests { - use Table; - use Slice; - use Row; - use Cell; - use format; + use crate::{Table, Slice, Row, Cell, format}; use format::consts::{FORMAT_DEFAULT, FORMAT_NO_LINESEP, FORMAT_NO_COLSEP, FORMAT_CLEAN, FORMAT_BOX_CHARS}; - use utils::StringWriter; + use crate::utils::StringWriter; #[test] fn table() { diff --git a/src/main.rs b/src/main.rs index 3cf20c5..28d7b78 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,9 @@ -// #![feature(trace_macros)] -#[macro_use] -extern crate prettytable; use prettytable::Table; use prettytable::Row; use prettytable::Cell; use prettytable::format::*; use prettytable::{Attr, color}; +use prettytable::{table, row, ptable}; // Import macros // trace_macros!(true); diff --git a/src/utils.rs b/src/utils.rs index 79e3be8..f2d89ae 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -108,7 +108,7 @@ pub fn display_width(text: &str) -> usize { #[cfg(test)] mod tests { use super::*; - use format::Alignment; + use crate::format::Alignment; use std::io::Write; #[test] -- cgit v1.2.3 From ffd151ab6ffa7581cae43b2a59cd5c94d406d862 Mon Sep 17 00:00:00 2001 From: Pierre-Henri Symoneaux Date: Sun, 25 Aug 2019 13:02:10 +0200 Subject: Removed unsupported rust versions --- .travis.yml | 2 -- README.md | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index ec95861..725fa91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,5 @@ language: rust rust: -- 1.30.0 -- 1.31.0 - 1.32.0 - 1.33.0 - 1.34.0 diff --git a/README.md b/README.md index 27de628..2689e17 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Include the library as a dependency to your project by adding the following line prettytable-rs = "^0.8" ``` -The library requires at least `rust v1.30.0`. +The library requires at least `rust v1.32.0`. ## Basic usage -- cgit v1.2.3