Repository: zhiburt/tabled (language: rust)

Issue:
clippy and tests fail due to simple problems
This issue is more of a way to understand the status of this project, as I love it and want to contribute by fixing some bugs. However, I found out that `cargo test` and `clippy` and thus CI don't work due to simple code errors.

Why is everyone ignoring them? Is it intentional or is it okay if someone fixes these errors?


Discussion / hints:
Hi @strange-dv 

Yes;
The `clippy` and tests fails came up by themselfs a few month ago, to be honest I am not sure even why.
Seemingly updated clippy; but why test got to fail that's very very interesting, I haven't checked to be brutally honest (I did but way back then).

I am not ignoring it.
I am aware of it.

I just have some OLD (VERY OLD) (a few months ....) patch I must have completed......
very interesting patch (at least 3 important ones)
But I ...... just .... can't get it done........sooooon hopefully....


So if you @strange-dv  want you can peek it up, it'd be great.
You can ping me if you'll got some issues.

PS: Overall I can do it too; as I said; I just haven't prioritized it
thanks for the answer! I'll try to pick it up!

Fix patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fdee55ee..e0f4fb13 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -120,7 +120,7 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v3
-      - uses: dtolnay/rust-toolchain@1.61.0
+      - uses: dtolnay/rust-toolchain@1.62.1
       - run: cargo build --manifest-path=./tabled/Cargo.toml --all-features
 
   fmt:
diff --git a/papergrid/Cargo.toml b/papergrid/Cargo.toml
index 00afe1e0..c4cc5542 100644
--- a/papergrid/Cargo.toml
+++ b/papergrid/Cargo.toml
@@ -13,7 +13,7 @@ std = []
 ansi = ["ansi-str", "ansitok"]
 
 [dependencies]
-unicode-width = "0.1"
+unicode-width = "=0.1.11"
 bytecount = "0.6"
 fnv = "1.0"
 ansi-str = { version = "0.8", optional = true }
diff --git a/tabled/Cargo.toml b/tabled/Cargo.toml
index 5782053d..8032161b 100644
--- a/tabled/Cargo.toml
+++ b/tabled/Cargo.toml
@@ -11,7 +11,6 @@ license = "MIT"
 keywords = ["table", "print", "pretty-table", "format", "terminal"]
 categories = ["text-processing", "visualization"]
 readme = "README.md"
-rust-version = "1.61.0"
 
 [badges]
 coveralls = { repository = "https://github.com/zhiburt/tabled", branch = "master", service = "github" }
@@ -307,11 +306,11 @@ ansi = ["papergrid/ansi", "ansi-str", "ansitok", "std"]
 macros = ["std"]
 
 [dependencies]
-papergrid = { version = "0.11", default-features = false }
+papergrid = { path="../papergrid", default-features = false }
 tabled_derive = { path = "../tabled_derive", optional = true }
 ansi-str = { version = "0.8", optional = true }
 ansitok = { version = "0.2", optional = true }
-unicode-width = "0.1"
+unicode-width = "=0.1.11"
 
 [dev-dependencies]
 owo-colors = "3.5"
diff --git a/tabled/src/lib.rs b/tabled/src/lib.rs
index 87502583..31b2e5f1 100644
--- a/tabled/src/lib.rs
+++ b/tabled/src/lib.rs
@@ -439,8 +439,8 @@ pub use crate::{tabled::Tabled, tables::Table};
 /// #[derive(Tabled)]
 /// struct Record {
 ///     #[tabled(skip)]
-///     id: [u8; 4],
-///     #[tabled(format("{}.{}.{}.{}.{}", self.id[0], self.id[1], self.id[2], self.id[3], self.name)]
+///     id: u8,
+///     #[tabled(format("{}.{}", self.id, self.name))]
 ///     name: String,
 /// }
 /// ```
diff --git a/tabled/src/settings/width/wrap.rs b/tabled/src/settings/width/wrap.rs
index eb21870f..a871c105 100644
--- a/tabled/src/settings/width/wrap.rs
+++ b/tabled/src/settings/width/wrap.rs
@@ -1438,39 +1438,3 @@ mod tests {
         );
     }
 }
-
-//  \u{1b}[37mReturns \u{1b}[39m\n
-//  \u{1b}[37mthe floor \u{1b}[39m\n
-//  \u{1b}[37mof a \u{1b}[39m\n
-//  \u{1b}[37mnumber \u{1b}[39m\u{1b}[49m\n
-//  \u{1b}[37m\u{1b}[41m(l\u{1b}[39m\u{1b}[37m\u{1b}[41marg\u{1b}[39m\u{1b}[49m\u{1b}[37mest \u{1b}[39m\n
-//  \u{1b}[37minteger \u{1b}[39m\n
-//  \u{1b}[37mless than \u{1b}[39m\n
-//  \u{1b}[37mor equal \u{1b}[39m\n
-//  \u{1b}[37mto that \u{1b}[39m\n
-//  \u{1b}[37mnumber).\u{1b}[39m  "
-
-//
-//
-
-//  \u{1b}[37mReturns \u{1b}[39m\n
-//  \u{1b}[37mthe floor \u{1b}[39m\n
-//  \u{1b}[37mof a \u{1b}[39m\n
-//  \u{1b}[37mnumber \u{1b}[39m\u{1b}[49m\n
-//  \u{1b}[37m\u{1b}[41m(l\u{1b}[39m\u{1b}[37m\u{1b}[41marg\u{1b}[39m\u{1b}[49m\u{1b}[37mest \u{1b}[39m\n
-//  \u{1b}[37minteger \u{1b}[39m\n
-//  \u{1b}[37mless than \u{1b}[39m\n
-//  \u{1b}[37mor equal \u{1b}[39m\n
-//  \u{1b}[37mto that \u{1b}[39m\n
-//  \u{1b}[37mnumber).\u{1b}[39m  "
-
-// "\u{1b}[37mReturns\u{1b}[37m \u{1b}[39m\n
-// \u{1b}[37mthe\u{1b}[37m floor\u{1b}[37m \u{1b}[39m\n
-// \u{1b}[37mof\u{1b}[37m a\u{1b}[37m \u{1b}[39m\n
-// \u{1b}[37mnumber\u{1b}[37m \u{1b}[39m\u{1b}[49m\n
-// \u{1b}[37m\u{1b}[41m(l\u{1b}[39m\u{1b}[37m\u{1b}[41marg\u{1b}[39m\u{1b}[49m\u{1b}[37mest\u{1b}[37m \u{1b}[39m\n
-// \u{1b}[37minteger\u{1b}[37m \u{1b}[39m\n
-// \u{1b}[37mless\u{1b}[37m than\u{1b}[37m \u{1b}[39m\n
-// \u{1b}[37mor\u{1b}[37m equal\u{1b}[37m \u{1b}[39m\n
-// \u{1b}[37mto\u{1b}[37m that\u{1b}[37m \u{1b}[39m\n
-// \u{1b}[37mnumber).\u{1b}[39m  "
diff --git a/tabled/src/tables/extended.rs b/tabled/src/tables/extended.rs
index 6a682ce1..7a806e9a 100644
--- a/tabled/src/tables/extended.rs
+++ b/tabled/src/tables/extended.rs
@@ -48,11 +48,11 @@
 //! assert_eq!(table, expected);
 //! ```
 
+use crate::grid::util::string::string_width;
+use crate::Tabled;
 use std::cell::RefCell;
 use std::fmt::{self, Debug, Display};
 use std::rc::Rc;
-use crate::grid::util::string::string_width;
-use crate::Tabled;
 
 /// `ExtendedTable` display data in a 'expanded display mode' from postgresql.
 /// It may be useful for a large data sets with a lot of fields.
diff --git a/tabled/src/tables/table_pool.rs b/tabled/src/tables/table_pool.rs
index 84840614..b1ee328c 100644
--- a/tabled/src/tables/table_pool.rs
+++ b/tabled/src/tables/table_pool.rs
@@ -1625,10 +1625,10 @@ mod print {
         pad_color: Sides<ANSIStr<'static>>,
     ) -> Sides<Option<ANSIStr<'static>>> {
         Sides::new(
-            (!pad_color.left.is_empty()).then(|| pad_color.left),
-            (!pad_color.right.is_empty()).then(|| pad_color.right),
-            (!pad_color.top.is_empty()).then(|| pad_color.top),
-            (!pad_color.bottom.is_empty()).then(|| pad_color.bottom),
+            (!pad_color.left.is_empty()).then_some(pad_color.left),
+            (!pad_color.right.is_empty()).then_some(pad_color.right),
+            (!pad_color.top.is_empty()).then_some(pad_color.top),
+            (!pad_color.bottom.is_empty()).then_some(pad_color.bottom),
         )
     }
 
diff --git a/tabled/src/util/string.rs b/tabled/src/util/string.rs
index 30266407..7eadea8b 100644
--- a/tabled/src/util/string.rs
+++ b/tabled/src/util/string.rs
@@ -201,7 +201,7 @@ mod tests {
         assert_eq!(cut_str("🏳️🏳️", 0), "");
         assert_eq!(cut_str("🏳️🏳️", 1), "🏳");
         assert_eq!(cut_str("🏳️🏳️", 2), "🏳\u{fe0f}🏳");
-        assert_eq!(string_width("🏳️🏳️"), string_width("🏳\u{fe0f}🏳"));
+        assert_eq!(string_width("🏳️🏳️"), string_width("🏳\u{fe0f}🏳\u{fe0f}"));
 
         assert_eq!(cut_str("🎓", 1), "�");
         assert_eq!(cut_str("🎓", 2), "🎓");
@@ -258,7 +258,7 @@ mod tests {
         );
         assert_eq!(
             string_width(&emojies),
-            string_width("\u{1b}[31;100m🏳\u{fe0f}🏳\u{1b}[39m\u{1b}[49m")
+            string_width("\u{1b}[31;100m🏳\u{fe0f}🏳\u{fe0f}\u{1b}[39m\u{1b}[49m")
         );
     }
 
diff --git a/tabled_derive/src/parse/field_attr.rs b/tabled_derive/src/parse/field_attr.rs
index 761a3333..56bb98c6 100644
--- a/tabled_derive/src/parse/field_attr.rs
+++ b/tabled_derive/src/parse/field_attr.rs
@@ -15,13 +15,12 @@ pub fn parse_field_attributes(
 }
 
 pub struct FieldAttr {
-    pub ident: Ident,
     pub kind: FieldAttrKind,
 }
 
 impl FieldAttr {
-    pub fn new(ident: Ident, kind: FieldAttrKind) -> Self {
-        Self { ident, kind }
+    pub fn new(kind: FieldAttrKind) -> Self {
+        Self { kind }
     }
 }
 
@@ -50,14 +49,12 @@ impl Parse for FieldAttr {
                 let lit = input.parse::<LitStr>()?;
 
                 match name_str.as_str() {
-                    "rename" => return Ok(Self::new(name, Rename(lit))),
-                    "rename_all" => return Ok(Self::new(name, RenameAll(lit))),
+                    "rename" => return Ok(Self::new(Rename(lit))),
+                    "rename_all" => return Ok(Self::new(RenameAll(lit))),
                     "display_with" => {
-                        return Ok(Self::new(name, DisplayWith(lit, None, Punctuated::new())))
-                    }
-                    "format" => {
-                        return Ok(Self::new(name, FormatWith(lit, None, Punctuated::new())))
+                        return Ok(Self::new(DisplayWith(lit, None, Punctuated::new())))
                     }
+                    "format" => return Ok(Self::new(FormatWith(lit, None, Punctuated::new()))),
                     _ => {}
                 }
             }
@@ -66,8 +63,8 @@ impl Parse for FieldAttr {
                 let lit = input.parse::<LitBool>()?;
 
                 match name_str.as_str() {
-                    "skip" => return Ok(Self::new(name, Skip(lit))),
-                    "inline" => return Ok(Self::new(name, Inline(lit, None))),
+                    "skip" => return Ok(Self::new(Skip(lit))),
+                    "inline" => return Ok(Self::new(Inline(lit, None))),
                     _ => {}
                 }
             }
@@ -76,7 +73,7 @@ impl Parse for FieldAttr {
                 let lit = input.parse::<LitInt>()?;
 
                 if let "order" = name_str.as_str() {
-                    return Ok(Self::new(name, Order(lit)));
+                    return Ok(Self::new(Order(lit)));
                 }
             }
 
@@ -111,16 +108,16 @@ impl Parse for FieldAttr {
                         };
 
                         if name_str.as_str() == "format" {
-                            return Ok(Self::new(name, FormatWith(lit, comma, args)));
+                            return Ok(Self::new(FormatWith(lit, comma, args)));
                         }
 
-                        return Ok(Self::new(name, DisplayWith(lit, comma, args)));
+                        return Ok(Self::new(DisplayWith(lit, comma, args)));
                     }
                     "inline" => {
-                        return Ok(Self::new(
-                            name,
-                            Inline(LitBool::new(true, Span::call_site()), Some(lit)),
-                        ))
+                        return Ok(Self::new(Inline(
+                            LitBool::new(true, Span::call_site()),
+                            Some(lit),
+                        )))
                     }
                     _ => {}
                 }
@@ -133,12 +130,12 @@ impl Parse for FieldAttr {
         }
 
         match name_str.as_str() {
-            "skip" => return Ok(Self::new(name, Skip(LitBool::new(true, Span::call_site())))),
+            "skip" => return Ok(Self::new(Skip(LitBool::new(true, Span::call_site())))),
             "inline" => {
-                return Ok(Self::new(
-                    name,
-                    Inline(LitBool::new(true, Span::call_site()), None),
-                ))
+                return Ok(Self::new(Inline(
+                    LitBool::new(true, Span::call_site()),
+                    None,
+                )))
             }
             _ => {}
         }
diff --git a/tabled_derive/src/parse/type_attr.rs b/tabled_derive/src/parse/type_attr.rs
index 6726b1e0..2ce6978e 100644
--- a/tabled_derive/src/parse/type_attr.rs
+++ b/tabled_derive/src/parse/type_attr.rs
@@ -14,13 +14,12 @@ pub fn parse_type_attributes(
 }
 
 pub struct TypeAttr {
-    pub ident: Ident,
     pub kind: TypeAttrKind,
 }
 
 impl TypeAttr {
-    pub fn new(ident: Ident, kind: TypeAttrKind) -> Self {
-        Self { ident, kind }
+    pub fn new(kind: TypeAttrKind) -> Self {
+        Self { kind }
     }
 }
 
@@ -36,14 +35,11 @@ impl Parse for TypeAttr {
         use TypeAttrKind::*;
 
         if input.peek(syn::token::Crate) {
-            let crate_token: syn::token::Crate = input.parse()?;
+            let _: syn::token::Crate = input.parse()?;
             let _ = input.parse::<Token![=]>()?;
             let value = input.parse::<LitStr>()?;
 
-            return Ok(Self::new(
-                Ident::new("crate", crate_token.span),
-                Crate(value),
-            ));
+            return Ok(Self::new(Crate(value)));
         }
 
         let name: Ident = input.parse()?;
@@ -56,7 +52,7 @@ impl Parse for TypeAttr {
                 let lit = input.parse::<LitStr>()?;
 
                 if let "rename_all" = name_str.as_str() {
-                    return Ok(Self::new(name, RenameAll(lit)));
+                    return Ok(Self::new(RenameAll(lit)));
                 }
             }
 
@@ -64,7 +60,7 @@ impl Parse for TypeAttr {
                 let lit = input.parse::<LitBool>()?;
 
                 if let "inline" = name_str.as_str() {
-                    return Ok(Self::new(name, Inline(lit, None)));
+                    return Ok(Self::new(Inline(lit, None)));
                 }
             }
 
@@ -82,10 +78,10 @@ impl Parse for TypeAttr {
                 let lit = nested.parse::<LitStr>()?;
 
                 if let "inline" = name_str.as_str() {
-                    return Ok(Self::new(
-                        name,
-                        Inline(LitBool::new(true, Span::call_site()), Some(lit)),
-                    ));
+                    return Ok(Self::new(Inline(
+                        LitBool::new(true, Span::call_site()),
+                        Some(lit),
+                    )));
                 }
             }
 
@@ -96,10 +92,10 @@ impl Parse for TypeAttr {
         }
 
         if let "inline" = name_str.as_str() {
-            return Ok(Self::new(
-                name,
-                Inline(LitBool::new(true, Span::call_site()), None),
-            ));
+            return Ok(Self::new(Inline(
+                LitBool::new(true, Span::call_site()),
+                None,
+            )));
         }
 
         Err(syn::Error::new(


Test patch:
diff --git a/tabled/tests/core/extended_table_test.rs b/tabled/tests/core/extended_table_test.rs
index 61328552..5a303ff0 100644
--- a/tabled/tests/core/extended_table_test.rs
+++ b/tabled/tests/core/extended_table_test.rs
@@ -473,16 +473,11 @@ fn display_with_truncate_colored() {
 
 #[test]
 fn record_template() {
-    build_tabled_type!(
-        TestType,
-        3,
-        ["1", "2", "3"],
-        ["a", "b", "c"]
-    );
+    build_tabled_type!(TestType, 3, ["1", "2", "3"], ["a", "b", "c"]);
     let data: Vec<TestType> = vec![TestType, TestType];
 
     let description = "ROW";
-    let table = ExtendedTable::new(&data)
+    let table = ExtendedTable::new(data)
         .template(move |index| format!("< {} {} >", description, index + 1));
     let table = table.to_string();
 
diff --git a/tabled/tests/derive/derive_test.rs b/tabled/tests/derive/derive_test.rs
index 53d00723..149e869e 100644
--- a/tabled/tests/derive/derive_test.rs
+++ b/tabled/tests/derive/derive_test.rs
@@ -17,8 +17,9 @@ macro_rules! test_tuple {
             $($($init_block)*)?
 
             #[derive(Tabled)]
-            struct TestType(
-                $( $(#[$attr])* $ty, )*
+            #[allow(dead_code)]
+            pub struct TestType(
+                $( $(#[$attr]) * $ty, )*
             );
 
             let value = TestType($($init,)*);
@@ -244,7 +245,12 @@ mod tuple {
     #[test]
     fn format3() {
         #[derive(Debug, Tabled)]
-        struct StructName(u8, #[tabled(format("foo {} {:?}", 2, self))] String);
+        pub struct StructName(
+            u8,
+            #[allow(dead_code)]
+            #[tabled(format("foo {} {:?}", 2, self))]
+            String,
+        );
 
         let value = StructName(0, String::from("string"));
 
@@ -1055,7 +1061,7 @@ fn rename_all_variants() {
         ( $name:ident, $case:expr ) => {
             #[derive(Tabled)]
             #[tabled(rename_all = $case)]
-            struct $name {
+            pub struct $name {
                 field: usize,
             }
         };
@@ -1211,7 +1217,7 @@ fn test_reimport_trait_by_crate_attribute() {
 #[test]
 fn test_display_with_2() {
     #[derive(tabled::Tabled)]
-    struct Struct<'a> {
+    pub struct Struct<'a> {
         #[tabled(display_with("std::path::Path::display"))]
         path: &'a std::path::Path,
     }
diff --git a/tabled/tests/settings/column_names_test.rs b/tabled/tests/settings/column_names_test.rs
index 5614bf2a..2908c3a4 100644
--- a/tabled/tests/settings/column_names_test.rs
+++ b/tabled/tests/settings/column_names_test.rs
@@ -215,7 +215,7 @@ test_table!(
 test_table!(
     colors_empty,
     Table::new([("Hello", "World"), ("and", "looooong\nword")])
-        .with(ColumnNames::default().color(vec![Color::default(); 0])),
+        .with(ColumnNames::default().color({ Color::default(); vec![] as std::vec::Vec<tabled::settings::Color> })),
     "+&str---+&str------+"
     "| Hello | World    |"
     "+-------+----------+"
diff --git a/testing_table/Cargo.toml b/testing_table/Cargo.toml
index 66716490..e82ed817 100644
--- a/testing_table/Cargo.toml
+++ b/testing_table/Cargo.toml
@@ -9,4 +9,4 @@ ansi = ["ansitok"]
 
 [dependencies]
 ansitok = { version = "0.2", optional = true }
-unicode-width = "0.1"
+unicode-width = "=0.1.11"