chore: clippies introduced with rust 1.68 (#3781)

- handle automatically fixable future clippies
- tune run-clippy.sh to remove macos specifics which we no longer have

Co-authored-by: Alexander Bayandin <alexander@neon.tech>
This commit is contained in:
Joonas Koivunen
2023-03-14 15:29:02 +02:00
committed by GitHub
parent 15b692ccc9
commit c23c8946a3
6 changed files with 13 additions and 28 deletions

View File

@@ -265,11 +265,9 @@ impl FeMessage {
b'c' => Ok(Some(FeMessage::CopyDone)), b'c' => Ok(Some(FeMessage::CopyDone)),
b'f' => Ok(Some(FeMessage::CopyFail)), b'f' => Ok(Some(FeMessage::CopyFail)),
b'p' => Ok(Some(FeMessage::PasswordMessage(msg))), b'p' => Ok(Some(FeMessage::PasswordMessage(msg))),
tag => { tag => Err(ProtocolError::Protocol(format!(
return Err(ProtocolError::Protocol(format!( "unknown message tag: {tag},'{msg:?}'"
"unknown message tag: {tag},'{msg:?}'" ))),
)))
}
} }
} }
} }

View File

@@ -11,7 +11,7 @@ where
P: AsRef<Path>, P: AsRef<Path>,
{ {
fn is_empty_dir(&self) -> io::Result<bool> { fn is_empty_dir(&self) -> io::Result<bool> {
Ok(fs::read_dir(self)?.into_iter().next().is_none()) Ok(fs::read_dir(self)?.next().is_none())
} }
} }

View File

@@ -1243,11 +1243,8 @@ impl Tenant {
"Cannot run GC iteration on inactive tenant" "Cannot run GC iteration on inactive tenant"
); );
let gc_result = self self.gc_iteration_internal(target_timeline_id, horizon, pitr, ctx)
.gc_iteration_internal(target_timeline_id, horizon, pitr, ctx) .await
.await;
gc_result
} }
/// Perform one compaction iteration. /// Perform one compaction iteration.

View File

@@ -3147,9 +3147,7 @@ impl Timeline {
} }
fail_point!("delta-layer-writer-fail-before-finish", |_| { fail_point!("delta-layer-writer-fail-before-finish", |_| {
return Err( Err(anyhow::anyhow!("failpoint delta-layer-writer-fail-before-finish").into())
anyhow::anyhow!("failpoint delta-layer-writer-fail-before-finish").into(),
);
}); });
writer.as_mut().unwrap().put_value(key, lsn, value)?; writer.as_mut().unwrap().put_value(key, lsn, value)?;

View File

@@ -14,7 +14,7 @@ pub const SCRAM_RAW_NONCE_LEN: usize = 18;
fn validate_sasl_extensions<'a>(parts: impl Iterator<Item = &'a str>) -> Option<()> { fn validate_sasl_extensions<'a>(parts: impl Iterator<Item = &'a str>) -> Option<()> {
for mut chars in parts.map(|s| s.chars()) { for mut chars in parts.map(|s| s.chars()) {
let attr = chars.next()?; let attr = chars.next()?;
if !('a'..='z').contains(&attr) && !('A'..='Z').contains(&attr) { if !attr.is_ascii_alphabetic() {
return None; return None;
} }
let eq = chars.next()?; let eq = chars.next()?;

View File

@@ -8,21 +8,13 @@
# warnings and errors right in the editor. # warnings and errors right in the editor.
# In vscode, this setting is Rust-analyzer>Check On Save:Command # In vscode, this setting is Rust-analyzer>Check On Save:Command
# Not every feature is supported in macOS builds. Avoid running regular linting
# script that checks every feature.
#
# manual-range-contains wants # manual-range-contains wants
# !(4..=MAX_STARTUP_PACKET_LENGTH).contains(&len) # !(4..=MAX_STARTUP_PACKET_LENGTH).contains(&len)
# instead of # instead of
# len < 4 || len > MAX_STARTUP_PACKET_LENGTH # len < 4 || len > MAX_STARTUP_PACKET_LENGTH
# , let's disagree. # , let's disagree.
if [[ "$OSTYPE" == "darwin"* ]]; then
# no extra features to test currently, add more here when needed # * `-A unknown_lints` do not warn about unknown lint suppressions
cargo clippy --locked --all --all-targets --features testing -- -A unknown_lints -A clippy::manual-range-contains -D warnings # that people with newer toolchains might use
else # * `-D warnings` - fail on any warnings (`cargo` returns non-zero exit status)
# * `-A unknown_lints` do not warn about unknown lint suppressions cargo clippy --locked --all --all-targets --all-features -- -A unknown_lints -A clippy::manual-range-contains -D warnings
# that people with newer toolchains might use
# * `-D warnings` - fail on any warnings (`cargo` returns non-zero exit status)
cargo clippy --locked --all --all-targets --all-features -- -A unknown_lints -A clippy::manual-range-contains -D warnings
fi