Commit Graph

171 Commits

Author SHA1 Message Date
Victor Song 72b2119a34 Simplify boolean assertions in tests 2023-02-24 18:29:37 -05:00
Victor Song 433a9a52d3 Use mutable slice instead of creating new Vec in filters 2023-02-24 18:29:37 -05:00
Victor Song 7c1878f0e4 Fix borrowing code smells 2023-02-24 18:29:37 -05:00
Victor Song 1f409793ae Use `pointer::cast` instead of `as` pointer casts 2023-02-24 18:29:37 -05:00
Victor Song 7595289698 Use `unsigned_abs` instead of casting from i64 to u64 2023-02-24 18:29:37 -05:00
Victor Song cd715a6e00 Safely derive `Eq` whenever we derive `PartialEq` 2023-02-24 18:29:37 -05:00
Mélanie Chauvel f3ca1fe6f7
Merge pull request #820 from skyline75489/chesterliu/dev/win-support
Initial support for Windows
2023-02-20 14:19:47 +01:00
TygrisIQ d40b7b1ff4
updated unix.stackexchange link from http to https 2022-07-17 09:39:30 +03:00
TygrisIQ 21758c81ea
Update fields.rs
changed unix.stackexchange.com from http to https
2022-07-17 09:35:14 +03:00
TygrisIQ 584b53bb17
updated links with markdown highlighting 2022-07-07 16:00:37 +03:00
TygrisIQ a4b23055a8
updated links with markdown highlighting 2022-07-07 15:59:21 +03:00
Mélanie Chauvel 8ad8b33573 Fix build on aarch64 and armv7 2022-05-08 03:19:09 +02:00
Chester Liu 6fb3740f24
Update src/fs/file.rs 2022-05-06 13:30:35 +08:00
Chester Liu 99d653b7fa Merge branch 'master' into chesterliu/dev/win-support 2021-10-29 15:50:54 +08:00
Mélanie Chauvel fe11b9d319 Fix panic on non UTF-8 file when using Git 2021-09-01 22:42:34 +02:00
Chester Liu 23a1c8a41f Merge branch 'master' into chesterliu/dev/win-support 2021-05-15 22:03:21 +08:00
ariasuni 785d6ed991 Fix clippy warnings for Rust 1.53 2021-05-13 02:44:22 +02:00
ariasuni 045172bd9e Fix all remaining clippy warnings
- Allow clippy::cast_*: generated warnings are mostly useless
- Fix the other warnings so using clippy is actually useful
2021-05-08 18:09:35 +02:00
ariasuni 86d5939abe Remove unused function 2021-05-08 16:20:17 +02:00
ariasuni 90416ed3ce Update comments about how the --git-ignore option is handled 2021-05-08 16:20:17 +02:00
ariasuni 7c80070120 Update broken link, remove content copied from said link
The old Google+ post is unavailable. The new link points to an article who saved the content and is also available on Wayback Machine.
2021-05-08 16:20:17 +02:00
Christian Göttsche 61ec153bcd Cleanup clippy warnings
warning: explicit lifetimes given in parameter types where they could be elided (or replaced with `'_` if needed by type declaration)
 --> src/output/escape.rs:4:1
  |
4 | pub fn escape<'a>(string: String, bits: &mut Vec<ANSIString<'a>>, good: Style, bad: Style) {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |

warning: this lifetime isn't used in the function definition
 --> src/output/escape.rs:4:15
  |
4 | pub fn escape<'a>(string: String, bits: &mut Vec<ANSIString<'_>>, good: Style, bad: Style) {
  |               ^^
  |

warning: single-character string constant used as pattern
   --> src/output/table.rs:310:41
    |
310 |                     if file.starts_with(":") {
    |                                         ^^^ help: try using a `char` instead: `':'`
    |

warning: single-character string constant used as pattern
   --> src/output/table.rs:310:41
    |
310 |                     if file.starts_with(":") {
    |                                         ^^^ help: try using a `char` instead: `':'`
    |

warning: methods called `new` usually return `Self`
  --> src/output/render/git.rs:38:5
   |
38 |     fn new(&self) -> Style;
   |     ^^^^^^^^^^^^^^^^^^^^^^^
   |

warning: this lifetime isn't used in the function definition
  --> src/output/icons.rs:40:22
   |
40 | pub fn iconify_style<'a>(style: Style) -> Style {
   |                      ^^
   |

warning: lint `clippy::find_map` has been removed: this lint has been replaced by `manual_find_map`, a more specific lint
  --> src/main.rs:11:10
   |
11 | #![allow(clippy::find_map)]
   |          ^^^^^^^^^^^^^^^^
   |

warning: redundant else block
   --> src/fs/dir.rs:124:18
    |
124 |               else {
    |  __________________^
125 | |                 return None
126 | |             }
    | |_____________^
    |

warning: redundant else block
  --> src/options/view.rs:60:18
   |
60 |               else {
   |  __________________^
61 | |                 // the --tree case is handled by the DirAction parser later
62 | |                 return Ok(Self::Details(details));
63 | |             }
   | |_____________^
   |

warning: all variants have the same postfix: `Bytes`
   --> src/output/table.rs:170:1
    |
170 | / pub enum SizeFormat {
171 | |
172 | |     /// Format the file size using **decimal** prefixes, such as “kilo”,
173 | |     /// “mega”, or “giga”.
...   |
181 | |     JustBytes,
182 | | }
    | |_^
    |

warning: all variants have the same postfix: `Bytes`
   --> src/output/table.rs:171:1
    |
171 | / pub enum SizeFormat {
172 | |
173 | |     /// Format the file size using **decimal** prefixes, such as “kilo”,
174 | |     /// “mega”, or “giga”.
...   |
182 | |     JustBytes,
183 | | }
    | |_^
    |

warning: useless use of `format!`
   --> src/options/mod.rs:181:50
    |
181 |               return Err(OptionsError::Unsupported(format!(
    |  __________________________________________________^
182 | |                 "Options --git and --git-ignore can't be used because `git` feature was disabled in this build of exa"
183 | |             )));
    | |_____________^ help: consider using `.to_string()`: `"Options --git and --git-ignore can't be used because `git` feature was disabled in this build of exa".to_string()`
    |

warning: stripping a prefix manually
   --> src/fs/filter.rs:287:33
    |
287 |         if n.starts_with('.') { &n[1..] }
    |                                 ^^^^^^^
    |

warning: case-sensitive file extension comparison
  --> src/info/filetype.rs:24:19
   |
24 |         file.name.ends_with(".ninja") ||
   |                   ^^^^^^^^^^^^^^^^^^^
   |
2021-04-30 15:37:31 +02:00
Chester Liu d6d35bf47e Hide _ prefix files 2021-04-20 17:47:58 +08:00
Chester Liu 8f0e4ccfdd Merge branch 'master' into chesterliu/dev/win-support 2021-04-13 11:27:49 +08:00
Benjamin Sago 311c9baf65 Explain device IDs with a comment 2021-04-11 23:34:29 +01:00
ariasuni bd4f144884 Fix deducing git ignored state for files too, not only directories 2021-04-10 00:56:07 +02:00
ariasuni 8c10feec51 Fix --git deducing ignored state in unintuitive way
It makes sense to consider that a directory has the aggregated status of all the files under it.

The exception is that for the ignored status, it’s more useful and intuitive to consider that it applies to everything under it.

- A directory containing an ignored file is no longer considered ignored
- A file inside an ignored directory is now considered ignored
2021-04-09 21:47:42 +02:00
skyline75489 8ad46e2ee5 Merge branch 'master' into chesterliu/dev/win-support 2021-04-03 21:12:19 +08:00
Benjamin Sago 4a108c1786 Fix a new compile-time warning 2021-04-01 09:39:12 +01:00
Chester Liu 0ea8f17b22 Clean 2021-03-31 11:04:11 +08:00
Chester Liu 00f97a9738 Mimic 'Mode' in gci 2021-03-30 17:13:00 +08:00
Chester Liu 78a3bc9838 Merge branch 'master' into chesterliu/dev/win-support 2021-03-30 11:58:39 +08:00
Chester Liu 9d613016c0 Git works! Hooray! 2021-03-28 11:30:32 +08:00
Chester Liu e874584a55 Try to fix CI 2021-03-28 09:31:03 +08:00
Chester Liu 13b3635407 Fix tests 2021-03-26 20:28:23 +08:00
Chester Liu 31583691d5 Timestamps 2021-03-26 18:40:22 +08:00
Chester Liu aeb4a679e8 It actually works 2021-03-26 17:47:18 +08:00
Chester Liu e9d0af0343 Restore more 2021-03-26 16:53:31 +08:00
Chester Liu 0e8a4582d0 Restore 2021-03-26 16:50:34 +08:00
Chester Liu 6a642d0f32 merge 2021-03-26 16:37:17 +08:00
ariasuni a740512014 Warm when git feature is disabled instead of ignoring flags
The flags --git and --git-ignore are caught early during options parsing, so no more checking for git feature is done elsewhere.

Since --git-ignore depends on git too since recently, remove it from help when git feature is disabled.

Extended attributes now don’t artificially depends on git feature being enabled.
2020-12-10 18:48:58 +01:00
Benjamin Sago 002080cde8 Clippy pedantic lints
This commit fixes a couple of Clippy warnings, and adds the list of lints we're OK with.

It does raise some important warnings, such as those to do with casting, which aren't allowed so they can be fixed later.
2020-10-13 01:46:17 +01:00
Benjamin Sago 3dc86c99ad New set of lints, and Rust 2018 idioms 2020-10-13 01:36:41 +01:00
Benjamin Sago ecbe63bf1e IO import changes 2020-10-13 00:54:06 +01:00
Benjamin Sago f8df02dae7 Batch source formatting
I read through every file and applied a couple of rustfmt suggestions. The brace placement and alignment of items on similar lines has been made consistent, even if neither are rustfmt's default style (a file has been put in place to enforce this). Other changes are:

• Alphabetical imports and modules
• Comma placement at the end of match blocks
• Use newlines and indentation judiciously
• Spaces around associated types
• Spaces after negations (it makes it more clear imho)
• Comment formatting
• Use early-returns and Optional `?` where appropriate
2020-10-10 20:02:55 +01:00
Benjamin Sago c3c39fee0a Various misc clippy fixes 2020-10-10 15:57:40 +01:00
Benjamin Sago a25cfe765d Remove some enum glob imports
These are holdovers from how I used to write Rust ("back in the day" of 2014). There are still some places in the code where I think it's worth glob-importing enums, but not these places.
2020-10-10 15:46:39 +01:00
Benjamin Sago f0c139ca68 Better referencing
This commit makes changes to the way variables are referenced:

• Make types Copy when possible
• Make methods take `self` instead of `&self` where possible (trivially_copy_pass_by_ref)
• Remove unnecessary borrowing (needless_ref)
• Remove unnecessary cloning (clone_on_copy)
• Remove `ref` from match arms where possible (new Rust match ergonomics)
2020-10-10 15:30:19 +01:00
Benjamin Sago 70a30ed683 The Selfening
This commit uses Clippy to fix all the 'use_self' warnings. Using Self instead of the type name has been good Rust style for a while now, and it's become the style I'm used to seeing.
2020-10-10 13:55:26 +01:00
Benjamin Sago 74d9f1402b Some Clippy fixes 2020-10-10 13:33:50 +01:00