Fix clippy lint

This commit is contained in:
Jonas Platte 2022-09-02 13:47:06 +02:00
parent 1aff2d0764
commit c745d3baf7
No known key found for this signature in database
GPG Key ID: AAA7A61F696C3E0C
6 changed files with 9 additions and 9 deletions

View File

@ -184,7 +184,7 @@ fn add_user_id_to_query<C: HttpClient + ?Sized, R: OutgoingRequest>(
use ruma_common::serde::urlencoded;
move |http_request| {
let extra_params = urlencoded::to_string(&[("user_id", user_id)]).unwrap();
let extra_params = urlencoded::to_string([("user_id", user_id)]).unwrap();
let uri = http_request.uri_mut();
let new_path_and_query = match uri.query() {
Some(params) => format!("{}?{params}&{extra_params}", uri.path()),

View File

@ -302,7 +302,7 @@ pub trait OutgoingRequestAppserviceExt: OutgoingRequest {
) -> Result<http::Request<T>, IntoHttpError> {
let mut http_request =
self.try_into_http_request(base_url, access_token, considering_versions)?;
let user_id_query = crate::serde::urlencoded::to_string(&[("user_id", user_id)])?;
let user_id_query = crate::serde::urlencoded::to_string([("user_id", user_id)])?;
let uri = http_request.uri().to_owned();
let mut parts = uri.into_parts();

View File

@ -328,7 +328,7 @@ impl Request {
let path_args: Vec<_> = path
.value()
.split('/')
.filter_map(|s| s.strip_prefix(':').map(&str::to_string))
.filter_map(|s| s.strip_prefix(':').map(str::to_string))
.collect();
let field_map: BTreeMap<_, _> =

View File

@ -332,7 +332,7 @@ pub fn reference_hash(
let hash = Sha256::digest(json.as_bytes());
Ok(encode_config(
&hash,
hash,
match version {
RoomVersionId::V1 | RoomVersionId::V2 | RoomVersionId::V3 => STANDARD_NO_PAD,
// Room versions higher than version 3 are url safe base64 encoded

View File

@ -226,7 +226,7 @@ mod tests {
#[test]
fn sign_empty_json() {
let key_pair = Ed25519KeyPair::from_der(
decode_config(&PKCS8, STANDARD_NO_PAD).unwrap().as_slice(),
decode_config(PKCS8, STANDARD_NO_PAD).unwrap().as_slice(),
"1".into(),
)
.unwrap();
@ -257,7 +257,7 @@ mod tests {
#[test]
fn sign_minimal_json() {
let key_pair = Ed25519KeyPair::from_der(
decode_config(&PKCS8, STANDARD_NO_PAD).unwrap().as_slice(),
decode_config(PKCS8, STANDARD_NO_PAD).unwrap().as_slice(),
"1".into(),
)
.unwrap();
@ -317,7 +317,7 @@ mod tests {
#[test]
fn sign_minimal_event() {
let key_pair = Ed25519KeyPair::from_der(
decode_config(&PKCS8, STANDARD_NO_PAD).unwrap().as_slice(),
decode_config(PKCS8, STANDARD_NO_PAD).unwrap().as_slice(),
"1".into(),
)
.unwrap();
@ -351,7 +351,7 @@ mod tests {
#[test]
fn sign_redacted_event() {
let key_pair = Ed25519KeyPair::from_der(
decode_config(&PKCS8, STANDARD_NO_PAD).unwrap().as_slice(),
decode_config(PKCS8, STANDARD_NO_PAD).unwrap().as_slice(),
"1".into(),
)
.unwrap();

View File

@ -144,7 +144,7 @@ impl Package {
/// Publish this package on crates.io.
pub fn publish(&self, client: &HttpClient, dry_run: bool) -> Result<bool> {
println!("Publishing {} {} on crates.io…", self.name, self.version);
let _dir = pushd(&self.manifest_path.parent().unwrap())?;
let _dir = pushd(self.manifest_path.parent().unwrap())?;
if self.is_published(client)? {
if ask_yes_no("This version is already published. Skip this step and continue?")? {