Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid new lints in 1.81.0 #337

Merged
merged 7 commits into from
Sep 23, 2024

Conversation

Techcable
Copy link
Member

@Techcable Techcable commented Sep 23, 2024

Avoid new lints:

  • Avoid check-cfg lint in 1.81.0
  • Rename ./cargo/config to .cargo/config.toml
  • test_edition2018: Explicitly specify edition = "2018"
  • Remove unused extern crate declarations, avoiding #[deny(unused_extern_crates)] lint.
    • Switch #[deny(rust_2018_idioms)] to #[warn(...)] to avoid unnecessary build failures in the future.
  • Unconditionally import from alloc/core
    • Declare #[no_std] if and only if #[cfg(not(feature = "std)], avoiding an extern crate std declaration.
      This expresses the intent clearer.
  • doc: Fix #[warn(clippy::doc_lazy_continuation)]
  • ci: Update the "recent hardcoded version" to 1.81 (used for clippy lints)

Make sure to:

  • Add an entry to CHANGELOG.md (if necessary)

@Techcable

This comment was marked as outdated.

@Techcable
Copy link
Member Author

Split the clippy CI changes into PR #339

This avoids the following warning:
```
warning: `/Users/nicholas/git/slog.org/slog/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
```

Since our MSRV is currently 1.49, we can safely make this change
without needing a system link.
These declarations are not needed.
This avoids the #[deny(unused_extern_crates)] lint, implied by #[deny(rust_2018_idioms)]

This error only occurs when the `nested-values` feature is enabled.
This error also seems to only occur on new versions (ex. 1.72 is fine).

Switch #[deny(rust_2018_idioms)] to #[warn(...)] to avoid unnecessary
build failures in the future.
Instead of doing this:
```
 #[cfg(not(feature = "std"))]
 use alloc::borrow::Cow;
 #[cfg(feature = "std")]
 use std::borrow::Cow;
```

Just unconditionally import from alloc:
```
use alloc::borrow::Cow;
```

Enable #[warn(clippy::std_instead_of_alloc, clippy::std_instead_of_core)]
to warn about these imports in the future.

Conditionally declare #[no_std] if and only if not(cfg(feature = "std"))
This is cleaner and avoids an `extern crate std` declaration,
but semantically there should be no difference.
@Techcable Techcable merged commit 4e24c23 into slog-rs:master Sep 23, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant