diff options
author | Pierre-Henri Symoneaux <phsym@users.noreply.github.com> | 2019-08-25 13:25:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-25 13:25:42 +0200 |
commit | d5f0296b2bb5c7c6c3b6347808e6bf37c3264766 (patch) | |
tree | a6fb13fdc05a94684fee9859c3355d478852ba3d | |
parent | fadaa64ec513177feeb858b0977b4c18899b4961 (diff) | |
parent | ffd151ab6ffa7581cae43b2a59cd5c94d406d862 (diff) |
Merge pull request #112 from phsym/ed-2018
Updated to rust 2018 edition
-rw-r--r-- | .travis.yml | 7 | ||||
-rw-r--r-- | Cargo.toml | 10 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | TODO.md | 12 | ||||
-rw-r--r-- | examples/basic.rs | 4 | ||||
-rw-r--r-- | examples/csv.rs | 2 | ||||
-rw-r--r-- | examples/formatting.rs | 4 | ||||
-rw-r--r-- | examples/multiline.rs | 4 | ||||
-rw-r--r-- | examples/slices.rs | 5 | ||||
-rw-r--r-- | examples/span.rs | 4 | ||||
-rw-r--r-- | examples/style.rs | 4 | ||||
-rw-r--r-- | examples/tictactoe.rs | 6 | ||||
-rw-r--r-- | src/cell.rs | 6 | ||||
-rw-r--r-- | src/csv.rs | 4 | ||||
-rw-r--r-- | src/lib.rs | 13 | ||||
-rw-r--r-- | src/main.rs | 4 | ||||
-rw-r--r-- | src/utils.rs | 2 |
17 files changed, 30 insertions, 63 deletions
diff --git a/.travis.yml b/.travis.yml index 2ac8945..725fa91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,11 @@ language: rust
rust:
-- 1.30.0
+- 1.32.0
+- 1.33.0
+- 1.34.0
+- 1.35.0
+- 1.36.0
+- 1.37.0
- stable
- beta
- nightly
@@ -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 }
@@ -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
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() { @@ -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\ @@ -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] |