Increase MSRV from 1.43 to 1.45
This commit is contained in:
parent
c96537c7d6
commit
a0e8bb416b
@ -6,8 +6,8 @@ sources:
|
|||||||
tasks:
|
tasks:
|
||||||
- rustup: |
|
- rustup: |
|
||||||
# We specify --profile minimal because we'd otherwise download docs
|
# We specify --profile minimal because we'd otherwise download docs
|
||||||
rustup toolchain install 1.43 --profile minimal
|
rustup toolchain install 1.45 --profile minimal
|
||||||
rustup default 1.43
|
rustup default 1.45
|
||||||
- test: |
|
- test: |
|
||||||
cd ruma
|
cd ruma
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ tasks:
|
|||||||
# tools, so capture tool exit codes and set the task exit code manually
|
# tools, so capture tool exit codes and set the task exit code manually
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
# We don't want to try building ruma-signatures on 1.43, since it depends
|
# We don't want to try building ruma-signatures on 1.45, since it depends
|
||||||
# on ring (MSRV 'stable') and is exempt from our MSRV policy. Instead,
|
# on ring (MSRV 'stable') and is exempt from our MSRV policy. Instead,
|
||||||
# enable all other dependencies on the ruma crate and try building that
|
# enable all other dependencies on the ruma crate and try building that
|
||||||
# (usually you would enable the higher-level features, but we're only
|
# (usually you would enable the higher-level features, but we're only
|
@ -53,7 +53,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|||||||
|
|
||||||
## Minimum Rust version
|
## Minimum Rust version
|
||||||
|
|
||||||
Ruma currently requires Rust 1.43. In general, we will never require beta or
|
Ruma currently requires Rust 1.45. In general, we will never require beta or
|
||||||
nightly for crates.io releases of our crates, and we will try to avoid releasing
|
nightly for crates.io releases of our crates, and we will try to avoid releasing
|
||||||
crates that depend on features that were only just stabilized.
|
crates that depend on features that were only just stabilized.
|
||||||
|
|
||||||
|
@ -367,12 +367,7 @@ pub fn expand_all(api: Api) -> syn::Result<TokenStream> {
|
|||||||
.method(#http::Method::#method)
|
.method(#http::Method::#method)
|
||||||
.uri(::std::format!(
|
.uri(::std::format!(
|
||||||
"{}{}{}",
|
"{}{}{}",
|
||||||
// FIXME: Once MSRV is >= 1.45.0, switch to
|
base_url.strip_suffix('/').unwrap_or(base_url),
|
||||||
// base_url.strip_suffix('/').unwrap_or(base_url),
|
|
||||||
match base_url.as_bytes().last() {
|
|
||||||
Some(b'/') => &base_url[..base_url.len() - 1],
|
|
||||||
_ => base_url,
|
|
||||||
},
|
|
||||||
#request_path_string,
|
#request_path_string,
|
||||||
#request_query_string,
|
#request_query_string,
|
||||||
))
|
))
|
||||||
|
@ -131,12 +131,7 @@ impl<'a> ruma_api::OutgoingRequest for Request<'a> {
|
|||||||
.method(http::Method::PUT)
|
.method(http::Method::PUT)
|
||||||
.uri(format!(
|
.uri(format!(
|
||||||
"{}/_matrix/client/r0/rooms/{}/send/{}/{}",
|
"{}/_matrix/client/r0/rooms/{}/send/{}/{}",
|
||||||
// FIXME: Once MSRV is >= 1.45.0, switch to
|
base_url.strip_suffix('/').unwrap_or(base_url),
|
||||||
// base_url.strip_suffix('/').unwrap_or(base_url),
|
|
||||||
match base_url.as_bytes().last() {
|
|
||||||
Some(b'/') => &base_url[..base_url.len() - 1],
|
|
||||||
_ => base_url,
|
|
||||||
},
|
|
||||||
utf8_percent_encode(self.room_id.as_str(), NON_ALPHANUMERIC),
|
utf8_percent_encode(self.room_id.as_str(), NON_ALPHANUMERIC),
|
||||||
utf8_percent_encode(self.content.event_type(), NON_ALPHANUMERIC),
|
utf8_percent_encode(self.content.event_type(), NON_ALPHANUMERIC),
|
||||||
utf8_percent_encode(&self.txn_id, NON_ALPHANUMERIC),
|
utf8_percent_encode(&self.txn_id, NON_ALPHANUMERIC),
|
||||||
|
@ -124,12 +124,7 @@ impl<'a> ruma_api::OutgoingRequest for Request<'a> {
|
|||||||
.method(http::Method::PUT)
|
.method(http::Method::PUT)
|
||||||
.uri(format!(
|
.uri(format!(
|
||||||
"{}/_matrix/client/r0/rooms/{}/state/{}",
|
"{}/_matrix/client/r0/rooms/{}/state/{}",
|
||||||
// FIXME: Once MSRV is >= 1.45.0, switch to
|
base_url.strip_suffix('/').unwrap_or(base_url),
|
||||||
// base_url.strip_suffix('/').unwrap_or(base_url),
|
|
||||||
match base_url.as_bytes().last() {
|
|
||||||
Some(b'/') => &base_url[..base_url.len() - 1],
|
|
||||||
_ => base_url,
|
|
||||||
},
|
|
||||||
utf8_percent_encode(self.room_id.as_str(), NON_ALPHANUMERIC),
|
utf8_percent_encode(self.room_id.as_str(), NON_ALPHANUMERIC),
|
||||||
utf8_percent_encode(self.content.event_type(), NON_ALPHANUMERIC),
|
utf8_percent_encode(self.content.event_type(), NON_ALPHANUMERIC),
|
||||||
))
|
))
|
||||||
|
@ -127,12 +127,7 @@ impl<'a> ruma_api::OutgoingRequest for Request<'a> {
|
|||||||
.method(http::Method::PUT)
|
.method(http::Method::PUT)
|
||||||
.uri(format!(
|
.uri(format!(
|
||||||
"{}/_matrix/client/r0/rooms/{}/state/{}/{}",
|
"{}/_matrix/client/r0/rooms/{}/state/{}/{}",
|
||||||
// FIXME: Once MSRV is >= 1.45.0, switch to
|
base_url.strip_suffix('/').unwrap_or(base_url),
|
||||||
// base_url.strip_suffix('/').unwrap_or(base_url),
|
|
||||||
match base_url.as_bytes().last() {
|
|
||||||
Some(b'/') => &base_url[..base_url.len() - 1],
|
|
||||||
_ => base_url,
|
|
||||||
},
|
|
||||||
utf8_percent_encode(self.room_id.as_str(), NON_ALPHANUMERIC),
|
utf8_percent_encode(self.room_id.as_str(), NON_ALPHANUMERIC),
|
||||||
utf8_percent_encode(self.content.event_type(), NON_ALPHANUMERIC),
|
utf8_percent_encode(self.content.event_type(), NON_ALPHANUMERIC),
|
||||||
utf8_percent_encode(&self.state_key, NON_ALPHANUMERIC),
|
utf8_percent_encode(&self.state_key, NON_ALPHANUMERIC),
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
//! Functions for signing and verifying JSON and events.
|
//! Functions for signing and verifying JSON and events.
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
|
borrow::Cow,
|
||||||
collections::{BTreeMap, BTreeSet},
|
collections::{BTreeMap, BTreeSet},
|
||||||
mem,
|
mem,
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
@ -138,14 +139,13 @@ pub fn sign_json<K>(
|
|||||||
where
|
where
|
||||||
K: KeyPair,
|
K: KeyPair,
|
||||||
{
|
{
|
||||||
// FIXME: Once MSRV >= 1.45.0, use remove_key and don't allocate new `String`s below.
|
let (signatures_key, mut signature_map) = match object.remove_entry("signatures") {
|
||||||
let mut signature_map = match object.remove("signatures") {
|
Some((key, CanonicalJsonValue::Object(signatures))) => (Cow::Owned(key), signatures),
|
||||||
Some(CanonicalJsonValue::Object(signatures)) => signatures,
|
|
||||||
Some(_) => return Err(Error::new("field `signatures` must be a JSON object")),
|
Some(_) => return Err(Error::new("field `signatures` must be a JSON object")),
|
||||||
None => BTreeMap::new(),
|
None => (Cow::Borrowed("signatures"), BTreeMap::new()),
|
||||||
};
|
};
|
||||||
|
|
||||||
let maybe_unsigned = object.remove("unsigned");
|
let maybe_unsigned_entry = object.remove_entry("unsigned");
|
||||||
|
|
||||||
// Get the canonical JSON string.
|
// Get the canonical JSON string.
|
||||||
let json = to_canonical_json_string(object)?;
|
let json = to_canonical_json_string(object)?;
|
||||||
@ -166,10 +166,10 @@ where
|
|||||||
signature_set.insert(signature.id(), CanonicalJsonValue::String(signature.base64()));
|
signature_set.insert(signature.id(), CanonicalJsonValue::String(signature.base64()));
|
||||||
|
|
||||||
// Put `signatures` and `unsigned` back in.
|
// Put `signatures` and `unsigned` back in.
|
||||||
object.insert("signatures".into(), CanonicalJsonValue::Object(signature_map));
|
object.insert(signatures_key.into(), CanonicalJsonValue::Object(signature_map));
|
||||||
|
|
||||||
if let Some(unsigned) = maybe_unsigned {
|
if let Some((k, v)) = maybe_unsigned_entry {
|
||||||
object.insert("unsigned".into(), unsigned);
|
object.insert(k, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user