1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 17:22:57 +01:00

lint and readme cleanup (#97)

This commit is contained in:
Rob Ede 2020-09-12 00:52:55 +01:00 committed by GitHub
parent 4a546718aa
commit 7a26d99c1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 56 additions and 74 deletions

View File

@ -590,7 +590,7 @@ impl Inner {
AllOrSome::Some(ref allowed_origins) => allowed_origins AllOrSome::Some(ref allowed_origins) => allowed_origins
.get(origin) .get(origin)
.map(|_| ()) .map(|_| ())
.ok_or_else(|| CorsError::OriginNotAllowed), .ok_or(CorsError::OriginNotAllowed),
}; };
} }
Err(CorsError::BadOrigin) Err(CorsError::BadOrigin)
@ -638,7 +638,7 @@ impl Inner {
.methods .methods
.get(&method) .get(&method)
.map(|_| ()) .map(|_| ())
.ok_or_else(|| CorsError::MethodNotAllowed); .ok_or(CorsError::MethodNotAllowed);
} }
} }
Err(CorsError::BadRequestMethod) Err(CorsError::BadRequestMethod)
@ -1072,6 +1072,7 @@ mod tests {
.collect::<Vec<&str>>(); .collect::<Vec<&str>>();
for h in exposed_headers { for h in exposed_headers {
#[allow(clippy::needless_collect)]
assert!(headers.contains(&h.as_str())); assert!(headers.contains(&h.as_str()));
} }
} }

View File

@ -2,15 +2,16 @@
name = "prost-example" name = "prost-example"
version = "0.5.1" version = "0.5.1"
edition = "2018" edition = "2018"
authors = ["kingxsp <jin.hb.zh@outlook.com>", "Yuki Okushi <huyuumi.dev@gmail.com>"] authors = [
"kingxsp <jin.hb.zh@outlook.com>",
"Yuki Okushi <huyuumi.dev@gmail.com>"
]
[dependencies] [dependencies]
actix-web = "3.0.0" actix-web = "3.0.0"
actix-rt = "1"
actix-protobuf = { path = "../../" } actix-protobuf = { path = "../../" }
bytes = "0.5" bytes = "0.5"
env_logger = "*" env_logger = "0.7"
prost = "0.6.0" prost = "0.6.0"
prost-derive = "0.6.0" prost-derive = "0.6.0"

View File

@ -1,13 +1,12 @@
#[macro_use]
extern crate prost_derive;
use actix_protobuf::*; use actix_protobuf::*;
use actix_web::*; use actix_web::*;
use prost_derive::Message;
#[derive(Clone, PartialEq, Message)] #[derive(Clone, PartialEq, Message)]
pub struct MyObj { pub struct MyObj {
#[prost(int32, tag = "1")] #[prost(int32, tag = "1")]
pub number: i32, pub number: i32,
#[prost(string, tag = "2")] #[prost(string, tag = "2")]
pub name: String, pub name: String,
} }
@ -17,7 +16,7 @@ async fn index(msg: ProtoBuf<MyObj>) -> Result<HttpResponse> {
HttpResponse::Ok().protobuf(msg.0) // <- send response HttpResponse::Ok().protobuf(msg.0) // <- send response
} }
#[actix_rt::main] #[actix_web::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "actix_web=debug,actix_server=info"); std::env::set_var("RUST_LOG", "actix_web=debug,actix_server=info");
env_logger::init(); env_logger::init();

View File

@ -241,7 +241,7 @@ impl<T: Message + Default + 'static> Future for ProtoBufMessage<T> {
} }
} }
return Ok(<T>::decode(&mut body)?); Ok(<T>::decode(&mut body)?)
} }
.boxed_local(), .boxed_local(),
); );

View File

@ -24,39 +24,32 @@
* Update `time` to 0.2.9 * Update `time` to 0.2.9
## [0.8.1] 2020-02-18 ## 0.8.1 - 2020-02-18
* Move `env_logger` dependency to dev-dependencies and update to 0.7 * Move `env_logger` dependency to dev-dependencies and update to 0.7
* Update `actix_web` to 2.0.0 from 2.0.0-rc * Update `actix_web` to 2.0.0 from 2.0.0-rc
* Move repository to actix-extras * Move repository to actix-extras
## [0.8.0] 2019-12-20
## 0.8.0 - 2019-12-20
* Release * Release
## [0.8.0-alpha.1] 2019-12-16
## 0.8.0-alpha.1 - 2019-12-16
* Migrate to actix 0.9 * Migrate to actix 0.9
## 0.7 (2019-09-25)
## 0.7.0 - 2019-09-25
* added cache_keygen functionality to RedisSession builder, enabling support for * added cache_keygen functionality to RedisSession builder, enabling support for
customizable cache key creation customizable cache key creation
## 0.6.1 (2019-07-19) ## 0.6.1 - 2019-07-19
* remove ClonableService usage * remove ClonableService usage
* added comprehensive tests for session workflow * added comprehensive tests for session workflow
## 0.6.0 (2019-07-08) ## 0.6.0 - 2019-07-08
* actix-web 1.0.0 compatibility * actix-web 1.0.0 compatibility
* Upgraded logic that evaluates session state, including new SessionStatus field, * Upgraded logic that evaluates session state, including new SessionStatus field,
and introduced ``session.renew()`` and ``session.purge()`` functionality. and introduced ``session.renew()`` and ``session.purge()`` functionality.
Use ``renew()`` to cycle the session key at successful login. ``renew()`` keeps a Use ``renew()`` to cycle the session key at successful login. ``renew()`` keeps a
@ -65,33 +58,27 @@
session's redis cache entry. session's redis cache entry.
## 0.5.1 - 2018-08-02
## 0.5.1 (2018-08-02)
* Use cookie 0.11 * Use cookie 0.11
## 0.5.0 (2018-07-21) ## 0.5.0 - 2018-07-21
* Session cookie configuration * Session cookie configuration
* Actix/Actix-web 0.7 compatibility * Actix/Actix-web 0.7 compatibility
## 0.4.0 (2018-05-08) ## 0.4.0 - 2018-05-08
* Actix web 0.6 compatibility * Actix web 0.6 compatibility
## 0.3.0 (2018-04-10)
## 0.3.0 - 2018-04-10
* Actix web 0.5 compatibility * Actix web 0.5 compatibility
## 0.2.0 (2018-02-28)
## 0.2.0 - 2018-02-28
* Use resolver actor from actix * Use resolver actor from actix
* Use actix web 0.5 * Use actix web 0.5
## 0.1.0 (2018-01-23)
## 0.1.0 - 2018-01-23
* First release * First release

View File

@ -8,7 +8,7 @@
* Minimum supported Rust version (MSRV) is now 1.42.0. * Minimum supported Rust version (MSRV) is now 1.42.0.
## [0.4.2] - 2020-07-08 ## 0.4.2 - 2020-07-08
- Update the `base64` dependency to 0.12 - Update the `base64` dependency to 0.12
- AuthenticationError's status code is preserved when converting to a ResponseError - AuthenticationError's status code is preserved when converting to a ResponseError
- Minimize `futures` dependency - Minimize `futures` dependency
@ -16,48 +16,42 @@
[#69]: https://github.com/actix/actix-web-httpauth/pull/69 [#69]: https://github.com/actix/actix-web-httpauth/pull/69
## [0.4.1] - 2020-02-19
## 0.4.1 - 2020-02-19
- Move repository to actix-extras - Move repository to actix-extras
## [0.4.0] - 2020-01-14
### Changed ## 0.4.0 - 2020-01-14
- Depends on `actix-web = "^2.0"`, `actix-service = "^1.0"`, and `futures = "^0.3"` version now ([#14]) - Depends on `actix-web = "^2.0"`, `actix-service = "^1.0"`, and `futures = "^0.3"` version now ([#14])
- Depends on `bytes = "^0.5"` and `base64 = "^0.11"` now - Depends on `bytes = "^0.5"` and `base64 = "^0.11"` now
[#14]: https://github.com/actix/actix-web-httpauth/pull/14 [#14]: https://github.com/actix/actix-web-httpauth/pull/14
## [0.3.2] - 2019-07-19
### Changed ## 0.3.2 - 2019-07-19
- Middleware accepts any `Fn` as a validator function instead of `FnMut` ([#11](https://github.com/actix/actix-web-httpauth/pull/11)) - Middleware accepts any `Fn` as a validator function instead of `FnMut` ([#11](https://github.com/actix/actix-web-httpauth/pull/11))
## [0.3.1] - 2019-06-09
### Fixed ## 0.3.1 - 2019-06-09
- Multiple calls to the middleware would result in panic - Multiple calls to the middleware would result in panic
## [0.3.0] - 2019-06-05
### Changed ## 0.3.0 - 2019-06-05
- Crate edition was changed to `2018`, same as `actix-web` - Crate edition was changed to `2018`, same as `actix-web`
- Depends on `actix-web = "^1.0"` version now - Depends on `actix-web = "^1.0"` version now
- `WWWAuthenticate` header struct was renamed into `WwwAuthenticate` - `WWWAuthenticate` header struct was renamed into `WwwAuthenticate`
- Challenges and extractor configs are now operating with `Cow<'static, str>` types instead of `String` types - Challenges and extractor configs are now operating with `Cow<'static, str>` types instead of `String` types
## [0.2.0] - 2019-04-26
### Changed ## 0.2.0 - 2019-04-26
- `actix-web` dependency is used without default features now ([#6](https://github.com/actix/actix-web-httpauth/pull/6)) - `actix-web` dependency is used without default features now ([#6](https://github.com/actix/actix-web-httpauth/pull/6))
- `base64` dependency version was bumped to `0.10` - `base64` dependency version was bumped to `0.10`
## [0.1.0] - 2018-09-08
### Changed ## 0.1.0 - 2018-09-08
- Update to `actix-web = "0.7"` version - Update to `actix-web = "0.7"` version
## [0.0.4] - 2018-07-01
### Fixed ## 0.0.4 - 2018-07-01
- Fix possible panic at `IntoHeaderValue` implementation for `headers::authorization::Basic` - Fix possible panic at `IntoHeaderValue` implementation for `headers::authorization::Basic`
- Fix possible panic at `headers::www_authenticate::challenge::bearer::Bearer::to_bytes` call - Fix possible panic at `headers::www_authenticate::challenge::bearer::Bearer::to_bytes` call