diff --git a/Cargo.toml b/Cargo.toml index 22afaccf493..19f12d9a5a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -180,6 +180,14 @@ windows = "0.54" windows-sys = "0.48" winreg = "0.52" +[workspace.lints.clippy] +# Warning: workspace lints affect library code as well as tests, so don't enable lints that would be too noisy in tests like that. +# todo = "warn" +unchecked_duration_subtraction = "warn" + +[lints] +workspace = true + [dependencies] nu-cli = { path = "./crates/nu-cli", version = "0.97.2" } nu-cmd-base = { path = "./crates/nu-cmd-base", version = "0.97.2" } diff --git a/crates/nu-cli/Cargo.toml b/crates/nu-cli/Cargo.toml index f392d3b9d90..2e357b09326 100644 --- a/crates/nu-cli/Cargo.toml +++ b/crates/nu-cli/Cargo.toml @@ -46,4 +46,7 @@ which = { workspace = true } [features] plugin = ["nu-plugin-engine"] -system-clipboard = ["reedline/system_clipboard"] \ No newline at end of file +system-clipboard = ["reedline/system_clipboard"] + +[lints] +workspace = true diff --git a/crates/nu-cmd-base/Cargo.toml b/crates/nu-cmd-base/Cargo.toml index 89ea225f288..afc75c336d6 100644 --- a/crates/nu-cmd-base/Cargo.toml +++ b/crates/nu-cmd-base/Cargo.toml @@ -9,6 +9,9 @@ version = "0.97.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lints] +workspace = true + [dependencies] nu-engine = { path = "../nu-engine", version = "0.97.2" } nu-parser = { path = "../nu-parser", version = "0.97.2" } @@ -18,4 +21,4 @@ nu-protocol = { path = "../nu-protocol", version = "0.97.2" } indexmap = { workspace = true } miette = { workspace = true } -[dev-dependencies] \ No newline at end of file +[dev-dependencies] diff --git a/crates/nu-cmd-extra/Cargo.toml b/crates/nu-cmd-extra/Cargo.toml index fae6568eaf3..bc5a2343b51 100644 --- a/crates/nu-cmd-extra/Cargo.toml +++ b/crates/nu-cmd-extra/Cargo.toml @@ -12,6 +12,9 @@ version = "0.97.2" [lib] bench = false +[lints] +workspace = true + [dependencies] nu-cmd-base = { path = "../nu-cmd-base", version = "0.97.2" } nu-engine = { path = "../nu-engine", version = "0.97.2" } @@ -35,4 +38,4 @@ itertools = { workspace = true } [dev-dependencies] nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.97.2" } nu-command = { path = "../nu-command", version = "0.97.2" } -nu-test-support = { path = "../nu-test-support", version = "0.97.2" } \ No newline at end of file +nu-test-support = { path = "../nu-test-support", version = "0.97.2" } diff --git a/crates/nu-cmd-lang/Cargo.toml b/crates/nu-cmd-lang/Cargo.toml index d287e80cc89..b248ad836a8 100644 --- a/crates/nu-cmd-lang/Cargo.toml +++ b/crates/nu-cmd-lang/Cargo.toml @@ -11,6 +11,9 @@ version = "0.97.2" [lib] bench = false +[lints] +workspace = true + [dependencies] nu-engine = { path = "../nu-engine", version = "0.97.2" } nu-parser = { path = "../nu-parser", version = "0.97.2" } @@ -28,4 +31,4 @@ mimalloc = [] trash-support = [] sqlite = [] static-link-openssl = [] -system-clipboard = [] \ No newline at end of file +system-clipboard = [] diff --git a/crates/nu-cmd-plugin/Cargo.toml b/crates/nu-cmd-plugin/Cargo.toml index 28c6abf8bc4..6442e978795 100644 --- a/crates/nu-cmd-plugin/Cargo.toml +++ b/crates/nu-cmd-plugin/Cargo.toml @@ -9,6 +9,9 @@ version = "0.97.2" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lints] +workspace = true + [dependencies] nu-engine = { path = "../nu-engine", version = "0.97.2" } nu-path = { path = "../nu-path", version = "0.97.2" } @@ -17,4 +20,4 @@ nu-plugin-engine = { path = "../nu-plugin-engine", version = "0.97.2" } itertools = { workspace = true } -[dev-dependencies] \ No newline at end of file +[dev-dependencies] diff --git a/crates/nu-color-config/Cargo.toml b/crates/nu-color-config/Cargo.toml index 2a7b1e9c6ce..3a7dce1b2b1 100644 --- a/crates/nu-color-config/Cargo.toml +++ b/crates/nu-color-config/Cargo.toml @@ -10,6 +10,9 @@ version = "0.97.2" [lib] bench = false +[lints] +workspace = true + [dependencies] nu-protocol = { path = "../nu-protocol", version = "0.97.2" } nu-engine = { path = "../nu-engine", version = "0.97.2" } @@ -19,4 +22,4 @@ nu-ansi-term = { workspace = true } serde = { workspace = true, features = ["derive"] } [dev-dependencies] -nu-test-support = { path = "../nu-test-support", version = "0.97.2" } \ No newline at end of file +nu-test-support = { path = "../nu-test-support", version = "0.97.2" } diff --git a/crates/nu-command/Cargo.toml b/crates/nu-command/Cargo.toml index 7c33a60a23b..837991cf5d7 100644 --- a/crates/nu-command/Cargo.toml +++ b/crates/nu-command/Cargo.toml @@ -12,6 +12,9 @@ version = "0.97.2" [lib] bench = false +[lints] +workspace = true + [dependencies] nu-cmd-base = { path = "../nu-cmd-base", version = "0.97.2" } nu-color-config = { path = "../nu-color-config", version = "0.97.2" } diff --git a/crates/nu-derive-value/Cargo.toml b/crates/nu-derive-value/Cargo.toml index bf28ec878f4..01ab5138b71 100644 --- a/crates/nu-derive-value/Cargo.toml +++ b/crates/nu-derive-value/Cargo.toml @@ -13,9 +13,12 @@ proc-macro = true # so we cannot test anything useful in a doctest doctest = false +[lints] +workspace = true + [dependencies] proc-macro2 = { workspace = true } syn = { workspace = true } quote = { workspace = true } proc-macro-error = { workspace = true } -heck = { workspace = true } \ No newline at end of file +heck = { workspace = true } diff --git a/crates/nu-engine/Cargo.toml b/crates/nu-engine/Cargo.toml index 42e5a0e07b9..04db74a14af 100644 --- a/crates/nu-engine/Cargo.toml +++ b/crates/nu-engine/Cargo.toml @@ -10,6 +10,9 @@ version = "0.97.2" [lib] bench = false +[lints] +workspace = true + [dependencies] nu-protocol = { path = "../nu-protocol", features = ["plugin"], version = "0.97.2" } nu-path = { path = "../nu-path", version = "0.97.2" } @@ -19,4 +22,4 @@ log = { workspace = true } terminal_size = { workspace = true } [features] -plugin = [] \ No newline at end of file +plugin = [] diff --git a/crates/nu-explore/Cargo.toml b/crates/nu-explore/Cargo.toml index b1acd89bf11..ad699c4bad4 100644 --- a/crates/nu-explore/Cargo.toml +++ b/crates/nu-explore/Cargo.toml @@ -10,6 +10,9 @@ version = "0.97.2" [lib] bench = false +[lints] +workspace = true + [dependencies] nu-protocol = { path = "../nu-protocol", version = "0.97.2" } nu-parser = { path = "../nu-parser", version = "0.97.2" } @@ -32,4 +35,4 @@ ansi-str = { workspace = true } unicode-width = { workspace = true } lscolors = { workspace = true, default-features = false, features = [ "nu-ansi-term", -] } \ No newline at end of file +] } diff --git a/crates/nu-glob/Cargo.toml b/crates/nu-glob/Cargo.toml index 4206fe85ade..299e72eec57 100644 --- a/crates/nu-glob/Cargo.toml +++ b/crates/nu-glob/Cargo.toml @@ -14,4 +14,7 @@ categories = ["filesystem"] bench = false [dev-dependencies] -doc-comment = "0.3" \ No newline at end of file +doc-comment = "0.3" + +[lints] +workspace = true diff --git a/crates/nu-json/Cargo.toml b/crates/nu-json/Cargo.toml index 139436d95b2..2c7d8545fb7 100644 --- a/crates/nu-json/Cargo.toml +++ b/crates/nu-json/Cargo.toml @@ -29,4 +29,7 @@ serde_json = { workspace = true } nu-test-support = { path = "../nu-test-support", version = "0.97.2" } nu-path = { path = "../nu-path", version = "0.97.2" } serde_json = "1.0" -fancy-regex = "0.13.0" \ No newline at end of file +fancy-regex = "0.13.0" + +[lints] +workspace = true diff --git a/crates/nu-lsp/Cargo.toml b/crates/nu-lsp/Cargo.toml index 255dc582532..b72bce9d03c 100644 --- a/crates/nu-lsp/Cargo.toml +++ b/crates/nu-lsp/Cargo.toml @@ -27,4 +27,7 @@ nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.97.2" } nu-command = { path = "../nu-command", version = "0.97.2" } nu-test-support = { path = "../nu-test-support", version = "0.97.2" } -assert-json-diff = "2.0" \ No newline at end of file +assert-json-diff = "2.0" + +[lints] +workspace = true diff --git a/crates/nu-parser/Cargo.toml b/crates/nu-parser/Cargo.toml index 49a0dbc0a7f..8f5145ed42e 100644 --- a/crates/nu-parser/Cargo.toml +++ b/crates/nu-parser/Cargo.toml @@ -11,6 +11,9 @@ exclude = ["/fuzz"] [lib] bench = false +[lints] +workspace = true + [dependencies] nu-engine = { path = "../nu-engine", version = "0.97.2" } nu-path = { path = "../nu-path", version = "0.97.2" } @@ -27,4 +30,4 @@ serde_json = { workspace = true } rstest = { workspace = true, default-features = false } [features] -plugin = ["nu-plugin-engine"] \ No newline at end of file +plugin = ["nu-plugin-engine"] diff --git a/crates/nu-path/Cargo.toml b/crates/nu-path/Cargo.toml index af219d58e05..7b684889862 100644 --- a/crates/nu-path/Cargo.toml +++ b/crates/nu-path/Cargo.toml @@ -18,4 +18,7 @@ dirs = { workspace = true } omnipath = { workspace = true } [target.'cfg(all(unix, not(target_os = "macos"), not(target_os = "android")))'.dependencies] -pwd = { workspace = true } \ No newline at end of file +pwd = { workspace = true } + +[lints] +workspace = true diff --git a/crates/nu-plugin-core/Cargo.toml b/crates/nu-plugin-core/Cargo.toml index 018f7d1f08b..ca4b63dc328 100644 --- a/crates/nu-plugin-core/Cargo.toml +++ b/crates/nu-plugin-core/Cargo.toml @@ -10,6 +10,9 @@ version = "0.97.2" [lib] bench = false +[lints] +workspace = true + [dependencies] nu-protocol = { path = "../nu-protocol", version = "0.97.2" } nu-plugin-protocol = { path = "../nu-plugin-protocol", version = "0.97.2", default-features = false } @@ -25,4 +28,4 @@ default = ["local-socket"] local-socket = ["interprocess", "nu-plugin-protocol/local-socket"] [target.'cfg(target_os = "windows")'.dependencies] -windows = { workspace = true } \ No newline at end of file +windows = { workspace = true } diff --git a/crates/nu-plugin-engine/Cargo.toml b/crates/nu-plugin-engine/Cargo.toml index cd01707da8b..3e16927a754 100644 --- a/crates/nu-plugin-engine/Cargo.toml +++ b/crates/nu-plugin-engine/Cargo.toml @@ -10,6 +10,9 @@ version = "0.97.2" [lib] bench = false +[lints] +workspace = true + [dependencies] nu-engine = { path = "../nu-engine", version = "0.97.2" } nu-protocol = { path = "../nu-protocol", version = "0.97.2" } @@ -32,4 +35,4 @@ local-socket = ["nu-plugin-core/local-socket"] windows = { workspace = true, features = [ # For setting process creation flags "Win32_System_Threading", -] } \ No newline at end of file +] } diff --git a/crates/nu-plugin-engine/src/gc.rs b/crates/nu-plugin-engine/src/gc.rs index 555c57e47d9..6aed37292df 100644 --- a/crates/nu-plugin-engine/src/gc.rs +++ b/crates/nu-plugin-engine/src/gc.rs @@ -244,7 +244,7 @@ mod tests { let mut state = test_state(); state.config.enabled = true; state.config.stop_after = Duration::from_secs(1).as_nanos() as i64; - state.last_update = Some(now - Duration::from_secs(2)); + state.last_update = Some(now.checked_sub(Duration::from_secs(2)).unwrap()); assert_eq!(Some(Duration::ZERO), state.next_timeout(now)); } @@ -295,7 +295,8 @@ mod tests { #[test] fn adding_locks_changes_last_update() { let mut state = test_state(); - let original_last_update = Some(Instant::now() - Duration::from_secs(1)); + let original_last_update = + Some(Instant::now().checked_sub(Duration::from_secs(1)).unwrap()); state.last_update = original_last_update; state.handle_message(PluginGcMsg::AddLocks(1)); assert_ne!(original_last_update, state.last_update, "not updated"); diff --git a/crates/nu-plugin-protocol/Cargo.toml b/crates/nu-plugin-protocol/Cargo.toml index bfd2dcbc286..45d8fe3a97a 100644 --- a/crates/nu-plugin-protocol/Cargo.toml +++ b/crates/nu-plugin-protocol/Cargo.toml @@ -10,6 +10,9 @@ version = "0.97.2" [lib] bench = false +[lints] +workspace = true + [dependencies] nu-protocol = { path = "../nu-protocol", version = "0.97.2", features = ["plugin"] } nu-utils = { path = "../nu-utils", version = "0.97.2" } @@ -21,4 +24,4 @@ typetag = "0.2" [features] default = ["local-socket"] -local-socket = [] \ No newline at end of file +local-socket = [] diff --git a/crates/nu-plugin-test-support/Cargo.toml b/crates/nu-plugin-test-support/Cargo.toml index 5e44966f8c7..9234bee18cc 100644 --- a/crates/nu-plugin-test-support/Cargo.toml +++ b/crates/nu-plugin-test-support/Cargo.toml @@ -9,6 +9,9 @@ repository = "https://github.com/nushell/nushell/tree/main/crates/nu-plugin-test [lib] bench = false +[lints] +workspace = true + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] @@ -25,4 +28,4 @@ similar = "2.6" [dev-dependencies] typetag = "0.2" -serde = "1.0" \ No newline at end of file +serde = "1.0" diff --git a/crates/nu-plugin/Cargo.toml b/crates/nu-plugin/Cargo.toml index 94d749de2c8..112b364a8bb 100644 --- a/crates/nu-plugin/Cargo.toml +++ b/crates/nu-plugin/Cargo.toml @@ -10,6 +10,9 @@ version = "0.97.2" [lib] bench = false +[lints] +workspace = true + [dependencies] nu-engine = { path = "../nu-engine", version = "0.97.2" } nu-protocol = { path = "../nu-protocol", version = "0.97.2" } @@ -30,4 +33,4 @@ local-socket = ["nu-plugin-core/local-socket"] [target.'cfg(target_family = "unix")'.dependencies] # For setting the process group ID (EnterForeground / LeaveForeground) -nix = { workspace = true, default-features = false, features = ["process"] } \ No newline at end of file +nix = { workspace = true, default-features = false, features = ["process"] } diff --git a/crates/nu-pretty-hex/Cargo.toml b/crates/nu-pretty-hex/Cargo.toml index 1f58d53340b..5d95c486d6a 100644 --- a/crates/nu-pretty-hex/Cargo.toml +++ b/crates/nu-pretty-hex/Cargo.toml @@ -13,9 +13,12 @@ name = "nu_pretty_hex" path = "src/lib.rs" bench = false +[lints] +workspace = true + [dependencies] nu-ansi-term = { workspace = true } [dev-dependencies] heapless = { version = "0.8", default-features = false } -rand = "0.8" \ No newline at end of file +rand = "0.8" diff --git a/crates/nu-protocol/Cargo.toml b/crates/nu-protocol/Cargo.toml index ead8ee80897..0a91d5fc1f1 100644 --- a/crates/nu-protocol/Cargo.toml +++ b/crates/nu-protocol/Cargo.toml @@ -12,6 +12,9 @@ version = "0.97.2" [lib] bench = false +[lints] +workspace = true + [dependencies] nu-utils = { path = "../nu-utils", version = "0.97.2" } nu-path = { path = "../nu-path", version = "0.97.2" } @@ -61,4 +64,4 @@ tempfile = { workspace = true } os_pipe = { workspace = true } [package.metadata.docs.rs] -all-features = true \ No newline at end of file +all-features = true diff --git a/crates/nu-std/Cargo.toml b/crates/nu-std/Cargo.toml index 1ecbd5280a7..6766b8ac3c6 100644 --- a/crates/nu-std/Cargo.toml +++ b/crates/nu-std/Cargo.toml @@ -13,4 +13,7 @@ nu-protocol = { version = "0.97.2", path = "../nu-protocol" } nu-engine = { version = "0.97.2", path = "../nu-engine" } miette = { workspace = true, features = ["fancy-no-backtrace"] } -log = "0.4" \ No newline at end of file +log = "0.4" + +[lints] +workspace = true diff --git a/crates/nu-system/Cargo.toml b/crates/nu-system/Cargo.toml index be7a36b3c6e..6de7fd0dc4d 100644 --- a/crates/nu-system/Cargo.toml +++ b/crates/nu-system/Cargo.toml @@ -12,6 +12,9 @@ license = "MIT" [lib] bench = false +[lints] +workspace = true + [dependencies] libc = { workspace = true } log = { workspace = true } @@ -45,4 +48,4 @@ windows = { workspace = true, features = [ "Win32_System_SystemInformation", "Win32_System_Threading", "Win32_UI_Shell", -]} \ No newline at end of file +]} diff --git a/crates/nu-table/Cargo.toml b/crates/nu-table/Cargo.toml index 21f2e041512..3cce028e354 100644 --- a/crates/nu-table/Cargo.toml +++ b/crates/nu-table/Cargo.toml @@ -10,6 +10,9 @@ version = "0.97.2" [lib] bench = false +[lints] +workspace = true + [dependencies] nu-protocol = { path = "../nu-protocol", version = "0.97.2" } nu-utils = { path = "../nu-utils", version = "0.97.2" } @@ -21,4 +24,4 @@ fancy-regex = { workspace = true } tabled = { workspace = true, features = ["ansi"], default-features = false } [dev-dependencies] -# nu-test-support = { path="../nu-test-support", version = "0.97.2" } \ No newline at end of file +# nu-test-support = { path="../nu-test-support", version = "0.97.2" } diff --git a/crates/nu-term-grid/Cargo.toml b/crates/nu-term-grid/Cargo.toml index b8a4328da34..858ca72e707 100644 --- a/crates/nu-term-grid/Cargo.toml +++ b/crates/nu-term-grid/Cargo.toml @@ -10,7 +10,10 @@ version = "0.97.2" [lib] bench = false +[lints] +workspace = true + [dependencies] nu-utils = { path = "../nu-utils", version = "0.97.2" } -unicode-width = { workspace = true } \ No newline at end of file +unicode-width = { workspace = true } diff --git a/crates/nu-test-support/Cargo.toml b/crates/nu-test-support/Cargo.toml index fa6f8185619..58db142732b 100644 --- a/crates/nu-test-support/Cargo.toml +++ b/crates/nu-test-support/Cargo.toml @@ -11,6 +11,9 @@ version = "0.97.2" doctest = false bench = false +[lints] +workspace = true + [dependencies] nu-path = { path = "../nu-path", version = "0.97.2" } nu-glob = { path = "../nu-glob", version = "0.97.2" } @@ -18,4 +21,4 @@ nu-utils = { path = "../nu-utils", version = "0.97.2" } num-format = { workspace = true } which = { workspace = true } -tempfile = { workspace = true } \ No newline at end of file +tempfile = { workspace = true } diff --git a/crates/nu-utils/Cargo.toml b/crates/nu-utils/Cargo.toml index a5b3e42d4ca..038ca449328 100644 --- a/crates/nu-utils/Cargo.toml +++ b/crates/nu-utils/Cargo.toml @@ -29,4 +29,7 @@ unicase = "2.7.0" crossterm_winapi = "0.9" [target.'cfg(unix)'.dependencies] -nix = { workspace = true, default-features = false, features = ["user", "fs"] } \ No newline at end of file +nix = { workspace = true, default-features = false, features = ["user", "fs"] } + +[lints] +workspace = true diff --git a/crates/nuon/Cargo.toml b/crates/nuon/Cargo.toml index 1f91935e48e..d34a649a95c 100644 --- a/crates/nuon/Cargo.toml +++ b/crates/nuon/Cargo.toml @@ -17,4 +17,7 @@ once_cell = { workspace = true } fancy-regex = { workspace = true } [dev-dependencies] -chrono = { workspace = true } \ No newline at end of file +chrono = { workspace = true } + +[lints] +workspace = true