Fix macos clippy issues

This commit is contained in:
Kirill Bulatov
2022-04-22 22:12:25 +03:00
committed by Kirill Bulatov
parent d060a97c54
commit fec050ce97
3 changed files with 23 additions and 10 deletions

View File

@@ -453,7 +453,7 @@ async fn tenant_config_handler(mut request: Request<Body>) -> Result<Response<Bo
.await
.map_err(ApiError::from_err)??;
Ok(json_response(StatusCode::OK, ())?)
json_response(StatusCode::OK, ())
}
async fn handler_404(_: Request<Body>) -> Result<Response<Body>, ApiError> {

View File

@@ -74,22 +74,28 @@ mod profiling_impl {
}
}
/// Dummy implementation when compiling without profiling feature
/// Dummy implementation when compiling without profiling feature or for non-linux OSes.
#[cfg(not(feature = "profiling"))]
mod profiling_impl {
use super::*;
pub fn profpoint_start(_conf: &PageServerConf, _point: ProfilingConfig) -> () {
()
pub struct DummyProfilerGuard;
pub fn profpoint_start(
_conf: &PageServerConf,
_point: ProfilingConfig,
) -> Option<DummyProfilerGuard> {
None
}
pub fn init_profiler(conf: &PageServerConf) -> () {
pub fn init_profiler(conf: &PageServerConf) -> Option<DummyProfilerGuard> {
if conf.profiling != ProfilingConfig::Disabled {
// shouldn't happen, we don't allow profiling in the config if the support
// for it is disabled.
panic!("profiling enabled but the binary was compiled without profiling support");
}
None
}
pub fn exit_profiler(_conf: &PageServerConf, _guard: &()) {}
pub fn exit_profiler(_conf: &PageServerConf, _guard: &Option<DummyProfilerGuard>) {}
}

View File

@@ -9,7 +9,14 @@
# In vscode, this setting is Rust-analyzer>Check On Save:Command
# * `-A unknown_lints` do not warn about unknown lint suppressions
# that people with newer toolchains might use
# * `-D warnings` - fail on any warnings (`cargo` returns non-zero exit status)
cargo clippy --all --all-targets --all-features -- -A unknown_lints -D warnings
# Not every feature is supported in macOS builds, e.g. `profiling`,
# avoid running regular linting script that checks every feature.
if [[ "$OSTYPE" == "darwin"* ]]; then
# no extra features to test currently, add more here when needed
cargo clippy --all --all-targets -- -A unknown_lints -D warnings
else
# * `-A unknown_lints` do not warn about unknown lint suppressions
# that people with newer toolchains might use
# * `-D warnings` - fail on any warnings (`cargo` returns non-zero exit status)
cargo clippy --all --all-targets --all-features -- -A unknown_lints -D warnings
fi