Skip to content

Commit

Permalink
Merge pull request #550 from cobalt-org/renovate/rust-1.x
Browse files Browse the repository at this point in the history
chore(deps): update dependency rust to v1.80.0
  • Loading branch information
epage authored Aug 7, 2024
2 parents ab5045b + 3cfe394 commit 2ced35d
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .clippy.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
msrv = "1.74" # MSRV
msrv = "1.80.0" # MSRV
warn-on-all-wildcard-imports = true
allow-expect-in-tests = true
allow-unwrap-in-tests = true
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ jobs:
- name: No-default features
run: cargo test --workspace --no-default-features
msrv:
name: "Check MSRV: 1.74"
name: "Check MSRV: 1.80.0"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.74" # MSRV
toolchain: "1.80.0" # MSRV
- uses: Swatinem/rust-cache@v2
- name: Default features
run: cargo check --workspace --all-targets
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.74" # MSRV
toolchain: "1.80.0" # MSRV
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Install SARIF tools
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ members = [
[workspace.package]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.74" # MSRV
rust-version = "1.80.0" # MSRV
include = [
"build.rs",
"src/**/*",
Expand Down
16 changes: 8 additions & 8 deletions crates/core/src/model/object/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ impl Object {
/// The key may be any borrowed form of the map's key type, but the ordering
/// on the borrowed form *must* match the ordering on the key type.
#[inline]
pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&Value>
pub fn get<Q>(&self, key: &Q) -> Option<&Value>
where
Key: Borrow<Q>,
Q: Ord + Eq + Hash,
Q: Ord + Eq + Hash + ?Sized,
{
self.map.get(key)
}
Expand All @@ -62,10 +62,10 @@ impl Object {
/// The key may be any borrowed form of the map's key type, but the ordering
/// on the borrowed form *must* match the ordering on the key type.
#[inline]
pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool
pub fn contains_key<Q>(&self, key: &Q) -> bool
where
Key: Borrow<Q>,
Q: Ord + Eq + Hash,
Q: Ord + Eq + Hash + ?Sized,
{
self.map.contains_key(key)
}
Expand All @@ -75,10 +75,10 @@ impl Object {
/// The key may be any borrowed form of the map's key type, but the ordering
/// on the borrowed form *must* match the ordering on the key type.
#[inline]
pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut Value>
pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut Value>
where
Key: Borrow<Q>,
Q: Ord + Eq + Hash,
Q: Ord + Eq + Hash + ?Sized,
{
self.map.get_mut(key)
}
Expand All @@ -100,10 +100,10 @@ impl Object {
/// The key may be any borrowed form of the map's key type, but the ordering
/// on the borrowed form *must* match the ordering on the key type.
#[inline]
pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<Value>
pub fn remove<Q>(&mut self, key: &Q) -> Option<Value>
where
Key: Borrow<Q>,
Q: Ord + Eq + Hash,
Q: Ord + Eq + Hash + ?Sized,
{
self.map.remove(key)
}
Expand Down
16 changes: 6 additions & 10 deletions crates/core/src/model/object/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,26 +125,22 @@ impl serde::Serializer for ObjectSerializer {
}

#[inline]
fn serialize_newtype_struct<T: ?Sized>(
self,
_name: &'static str,
value: &T,
) -> Result<Object, SerError>
fn serialize_newtype_struct<T>(self, _name: &'static str, value: &T) -> Result<Object, SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
value.serialize(ObjectSerializer)
}

fn serialize_newtype_variant<T: ?Sized>(
fn serialize_newtype_variant<T>(
self,
_name: &'static str,
_variant_index: u32,
variant: &'static str,
value: &T,
) -> Result<Object, SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
let mut values = Object::new();
values.insert(
Expand All @@ -160,9 +156,9 @@ impl serde::Serializer for ObjectSerializer {
}

#[inline]
fn serialize_some<T: ?Sized>(self, value: &T) -> Result<Object, SerError>
fn serialize_some<T>(self, value: &T) -> Result<Object, SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
value.serialize(ObjectSerializer)
}
Expand Down
8 changes: 4 additions & 4 deletions crates/core/src/model/scalar/datetime/strftime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ impl fmt::Display for DateFormatError {
/// Know exceptions are listed below:
///
/// - `%Z` is used to print the (possibly) abbreviated time zone name. `chrono`
/// did not actually implement this and instead just put the UTC offset with a
/// colon, ie +/-HH:MM, and Ruby itself recommends _not_ using `%Z` as it is
/// OS-dependent on what the string will be, in addition to the abbreviated time
/// zone names being ambiguous. `Z` is also not supported at all by liquidjs.
/// did not actually implement this and instead just put the UTC offset with a
/// colon, ie +/-HH:MM, and Ruby itself recommends _not_ using `%Z` as it is
/// OS-dependent on what the string will be, in addition to the abbreviated time
/// zone names being ambiguous. `Z` is also not supported at all by liquidjs.
pub fn strftime(ts: time::OffsetDateTime, fmt: &str) -> Result<String, DateFormatError> {
let mut output = String::new();
let mut fmt_iter = fmt.char_indices().peekable();
Expand Down
16 changes: 6 additions & 10 deletions crates/core/src/model/scalar/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,26 +126,22 @@ impl serde::Serializer for ScalarSerializer {
self.serialize_str(variant)
}

fn serialize_newtype_struct<T: ?Sized>(
self,
_name: &'static str,
value: &T,
) -> Result<Scalar, SerError>
fn serialize_newtype_struct<T>(self, _name: &'static str, value: &T) -> Result<Scalar, SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
value.serialize(ScalarSerializer)
}

fn serialize_newtype_variant<T: ?Sized>(
fn serialize_newtype_variant<T>(
self,
_name: &'static str,
_variant_index: u32,
_variant: &'static str,
_value: &T,
) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Err(scalar_must_be_a_string())
}
Expand All @@ -154,9 +150,9 @@ impl serde::Serializer for ScalarSerializer {
Err(scalar_must_be_a_string())
}

fn serialize_some<T: ?Sized>(self, _value: &T) -> Result<Self::Ok, Self::Error>
fn serialize_some<T>(self, _value: &T) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Err(scalar_must_be_a_string())
}
Expand Down
32 changes: 16 additions & 16 deletions crates/core/src/model/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ impl<O: From<Object>> serde::ser::SerializeStructVariant for SerializeStructVari
type Ok = O;
type Error = SerError;

fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<(), SerError>
fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<(), SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
self.map
.insert(KString::from_static(key), value.serialize(ValueSerializer)?);
Expand All @@ -109,9 +109,9 @@ impl<O: From<Object>> serde::ser::SerializeTupleVariant for SerializeTupleVarian
type Ok = O;
type Error = SerError;

fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), SerError>
fn serialize_field<T>(&mut self, value: &T) -> Result<(), SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
self.vec.push(value.serialize(ValueSerializer)?);
Ok(())
Expand All @@ -138,9 +138,9 @@ impl<O: From<Object>> serde::ser::SerializeStruct for SerializeMap<O> {
type Ok = O;
type Error = SerError;

fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<(), SerError>
fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<(), SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
match *self {
SerializeMap::Map {
Expand All @@ -163,9 +163,9 @@ impl<O: From<Object>> serde::ser::SerializeMap for SerializeMap<O> {
type Ok = O;
type Error = SerError;

fn serialize_key<T: ?Sized>(&mut self, key: &T) -> Result<(), SerError>
fn serialize_key<T>(&mut self, key: &T) -> Result<(), SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
match *self {
SerializeMap::Map {
Expand All @@ -177,9 +177,9 @@ impl<O: From<Object>> serde::ser::SerializeMap for SerializeMap<O> {
}
}

fn serialize_value<T: ?Sized>(&mut self, value: &T) -> Result<(), SerError>
fn serialize_value<T>(&mut self, value: &T) -> Result<(), SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
match *self {
SerializeMap::Map {
Expand Down Expand Up @@ -233,13 +233,13 @@ impl serde::Serializer for MapKeySerializer {
}

#[inline]
fn serialize_newtype_struct<T: ?Sized>(
fn serialize_newtype_struct<T>(
self,
_name: &'static str,
value: &T,
) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
value.serialize(self)
}
Expand Down Expand Up @@ -314,15 +314,15 @@ impl serde::Serializer for MapKeySerializer {
Err(key_must_be_a_string())
}

fn serialize_newtype_variant<T: ?Sized>(
fn serialize_newtype_variant<T>(
self,
_name: &'static str,
_variant_index: u32,
_variant: &'static str,
_value: &T,
) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Err(key_must_be_a_string())
}
Expand All @@ -331,9 +331,9 @@ impl serde::Serializer for MapKeySerializer {
Err(key_must_be_a_string())
}

fn serialize_some<T: ?Sized>(self, _value: &T) -> Result<Self::Ok, Self::Error>
fn serialize_some<T>(self, _value: &T) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
T: Serialize + ?Sized,
{
Err(key_must_be_a_string())
}
Expand Down
28 changes: 12 additions & 16 deletions crates/core/src/model/value/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,26 +138,22 @@ impl serde::Serializer for ValueSerializer {
}

#[inline]
fn serialize_newtype_struct<T: ?Sized>(
self,
_name: &'static str,
value: &T,
) -> Result<Value, SerError>
fn serialize_newtype_struct<T>(self, _name: &'static str, value: &T) -> Result<Value, SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
value.serialize(ValueSerializer)
}

fn serialize_newtype_variant<T: ?Sized>(
fn serialize_newtype_variant<T>(
self,
_name: &'static str,
_variant_index: u32,
variant: &'static str,
value: &T,
) -> Result<Value, SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
let mut values = Object::new();
values.insert(
Expand All @@ -173,9 +169,9 @@ impl serde::Serializer for ValueSerializer {
}

#[inline]
fn serialize_some<T: ?Sized>(self, value: &T) -> Result<Value, SerError>
fn serialize_some<T>(self, value: &T) -> Result<Value, SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
value.serialize(ValueSerializer)
}
Expand Down Expand Up @@ -253,9 +249,9 @@ impl serde::ser::SerializeSeq for SerializeVec {
type Ok = Value;
type Error = SerError;

fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), SerError>
fn serialize_element<T>(&mut self, value: &T) -> Result<(), SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
self.vec.push(value.serialize(ValueSerializer)?);
Ok(())
Expand All @@ -270,9 +266,9 @@ impl serde::ser::SerializeTuple for SerializeVec {
type Ok = Value;
type Error = SerError;

fn serialize_element<T: ?Sized>(&mut self, value: &T) -> Result<(), SerError>
fn serialize_element<T>(&mut self, value: &T) -> Result<(), SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
serde::ser::SerializeSeq::serialize_element(self, value)
}
Expand All @@ -286,9 +282,9 @@ impl serde::ser::SerializeTupleStruct for SerializeVec {
type Ok = Value;
type Error = SerError;

fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), SerError>
fn serialize_field<T>(&mut self, value: &T) -> Result<(), SerError>
where
T: Serialize,
T: Serialize + ?Sized,
{
serde::ser::SerializeSeq::serialize_element(self, value)
}
Expand Down

0 comments on commit 2ced35d

Please sign in to comment.