Skip to content

Commit

Permalink
style: fix nightly lints (#488)
Browse files Browse the repository at this point in the history
Signed-off-by: Tiago Castro <[email protected]>
  • Loading branch information
tiagolobocastro authored Dec 22, 2022
1 parent 33cd55f commit 9d87629
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 21 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,31 @@ jobs:
clippy:
name: clippy
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
rust:
- stable
- nightly
experimental: [false]
include:
- profile: stable
experimental: false
- profile: nightly
experimental: true
exclude: -A clippy::uninlined-format-args
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions-rs/toolchain@v1
with:
components: clippy
toolchain: ${{ matrix.rust }}
toolchain: ${{ matrix.profile }}
override: true
- uses: actions-rs/clippy-check@v1
continue-on-error: ${{ matrix.experimental }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all --features "actix4 cli chrono url uuid swagger-ui v3" -- -D clippy::all
args: --all --features "actix4 cli chrono url uuid swagger-ui v3" -- -D clippy::all ${{ matrix.exclude }}

fmt:
name: rustfmt
Expand Down
14 changes: 8 additions & 6 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ let
in
pkgs.mkShell {
buildInputs = with pkgs; [
nixpkgs-fmt
openssl
pkg-config
] ++ pkgs.lib.optional (!rustup) rust;
] ++ pkgs.lib.optional (!rustup) rust
++ pkgs.lib.optional (system == "aarch64-darwin") darwin.apple_sdk.frameworks.Security;
shellHook = ''
cat <<EOF >rust-toolchain.toml
[toolchain]
channel = "${profile}-${date}"
components = [ "rust-src" ]
EOF
cat <<EOF >rust-toolchain.toml
[toolchain]
channel = "${profile}-${date}"
components = [ "rust-src" ]
EOF
'';
}
16 changes: 8 additions & 8 deletions src/v2/codegen/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,10 @@ pub trait Emitter: Sized {
/// and defines/reuses types based on the given context.
///
/// **NOTE:** Not meant to be overridden.
fn build_def<'a>(
fn build_def(
&self,
def: &Self::Definition,
ctx: DefinitionContext<'a>,
ctx: DefinitionContext<'_>,
) -> Result<EmittedUnit, Error> {
if let Some(u) = CodegenEmitter(self).try_emit_enum(def, ctx.clone())? {
return Ok(u);
Expand Down Expand Up @@ -444,10 +444,10 @@ where

/// Assumes that the given definition is an array and returns the corresponding
/// vector type for it.
fn emit_array<'c>(
fn emit_array(
&self,
def: &E::Definition,
ctx: DefinitionContext<'c>,
ctx: DefinitionContext<'_>,
) -> Result<EmittedUnit, Error> {
let it = def
.items()
Expand Down Expand Up @@ -532,10 +532,10 @@ where

/// Assumes that the given definition is an object and returns the corresponding
/// Rust struct / map.
fn emit_object<'c>(
fn emit_object(
&self,
def: &E::Definition,
ctx: DefinitionContext<'c>,
ctx: DefinitionContext<'_>,
) -> Result<EmittedUnit, Error> {
match self.try_emit_map(def, &ctx)? {
EmittedUnit::None => (),
Expand Down Expand Up @@ -572,10 +572,10 @@ where
}
}

fn emit_known_object_path<'c>(
fn emit_known_object_path(
&self,
def: &E::Definition,
ctx: DefinitionContext<'c>,
ctx: DefinitionContext<'_>,
) -> Result<EmittedUnit, Error> {
// Use absolute paths to save some pain.
let mut ty_path = String::from(self.state().mod_prefix.trim_matches(':'));
Expand Down
2 changes: 1 addition & 1 deletion src/v2/codegen/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ impl<'a, 'b> SendableCodegen<'a, 'b> {
|| self.builder.response.contains_any
{
let (range, coder) = match self.builder.decoding {
Some(&(ref r, ref c)) => (r.as_str(), c),
Some((r, c)) => (r.as_str(), c),
None => ((JSON_MIME).0.as_ref(), &*JSON_CODER),
};

Expand Down
3 changes: 2 additions & 1 deletion tests/test_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ impl Default for Pet {
Self {
name: "".to_string(),
class: PetClass::EverythingElse,
birthday: chrono_dev::NaiveDate::from_ymd(2012, 3, 10),
birthday: chrono_dev::NaiveDate::from_ymd_opt(2012, 3, 10)
.expect("invalid or out-of-range date"),
id: None,
updated_on: None,
uid0: None,
Expand Down

0 comments on commit 9d87629

Please sign in to comment.