Skip to content

Commit

Permalink
Merge pull request #1753 from artichoke/rust-1.59.0
Browse files Browse the repository at this point in the history
Upgrade Rust toolchain to 1.59.0
  • Loading branch information
lopopolo committed Apr 8, 2022
2 parents ac57688 + 5e34d37 commit 672a7e8
Show file tree
Hide file tree
Showing 34 changed files with 58 additions and 63 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ jobs:
shell: bash
run: |
echo "::group::rustup toolchain install"
rustup toolchain install 1.58.1 --profile minimal
rustup toolchain install 1.59.0 --profile minimal
echo "::endgroup::"
echo "::group::set default toolchain"
rm -rf rust-toolchain
rustup default 1.58.1
rustup default 1.59.0
echo "::endgroup::"
echo "::group::rustup version"
rustup -Vv
Expand Down Expand Up @@ -70,11 +70,11 @@ jobs:
- name: Install Rust toolchain
run: |
echo "::group::rustup toolchain install"
rustup toolchain install 1.58.1 --profile minimal --component clippy
rustup toolchain install 1.59.0 --profile minimal --component clippy
echo "::endgroup::"
echo "::group::set default toolchain"
rm -rf rust-toolchain
rustup default 1.58.1
rustup default 1.59.0
echo "::endgroup::"
echo "::group::rustup version"
rustup -Vv
Expand Down Expand Up @@ -140,11 +140,11 @@ jobs:
- name: Install Rust toolchain
run: |
echo "::group::rustup toolchain install"
rustup toolchain install 1.58.1 --profile minimal
rustup toolchain install 1.59.0 --profile minimal
echo "::endgroup::"
echo "::group::set default toolchain"
rm -rf rust-toolchain
rustup default 1.58.1
rustup default 1.59.0
echo "::endgroup::"
echo "::group::rustup version"
rustup -Vv
Expand Down Expand Up @@ -177,11 +177,11 @@ jobs:
- name: Install Rust toolchain
run: |
echo "::group::rustup toolchain install"
rustup toolchain install 1.58.1 --profile minimal --component clippy
rustup toolchain install 1.59.0 --profile minimal --component clippy
echo "::endgroup::"
echo "::group::set default toolchain"
rm -rf rust-toolchain
rustup default 1.58.1
rustup default 1.59.0
echo "::endgroup::"
echo "::group::rustup version"
rustup -Vv
Expand Down Expand Up @@ -247,11 +247,11 @@ jobs:
- name: Install Rust toolchain
run: |
echo "::group::rustup toolchain install"
rustup toolchain install 1.58.1 --profile minimal --component clippy
rustup toolchain install 1.59.0 --profile minimal --component clippy
echo "::endgroup::"
echo "::group::set default toolchain"
rm -rf rust-toolchain
rustup default 1.58.1
rustup default 1.59.0
echo "::endgroup::"
echo "::group::rustup version"
rustup -Vv
Expand Down Expand Up @@ -328,11 +328,11 @@ jobs:
- name: Install Rust toolchain
run: |
echo "::group::rustup toolchain install"
rustup toolchain install 1.58.1 --profile minimal
rustup toolchain install 1.59.0 --profile minimal
echo "::endgroup::"
echo "::group::set default toolchain"
rm -rf rust-toolchain
rustup default 1.58.1
rustup default 1.59.0
echo "::endgroup::"
echo "::group::rustup version"
rustup -Vv
Expand Down Expand Up @@ -491,11 +491,11 @@ jobs:
- name: Install Rust toolchain
run: |
echo "::group::rustup toolchain install"
rustup toolchain install 1.58.1 --profile minimal
rustup toolchain install 1.59.0 --profile minimal
echo "::endgroup::"
echo "::group::set default toolchain"
rm -rf rust-toolchain
rustup default 1.58.1
rustup default 1.59.0
echo "::endgroup::"
echo "::group::rustup version"
rustup -Vv
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/crash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
- name: Install Rust toolchain
run: |
echo "::group::rustup toolchain install"
rustup toolchain install 1.58.1 --profile minimal
rustup toolchain install 1.59.0 --profile minimal
echo "::endgroup::"
echo "::group::set default toolchain"
rm -rf rust-toolchain
rustup default 1.58.1
rustup default 1.59.0
echo "::endgroup::"
echo "::group::rustup version"
rustup -Vv
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spec-state.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
- name: Install Rust toolchain
run: |
echo "::group::rustup toolchain install"
rustup toolchain install 1.58.1 --profile minimal
rustup toolchain install 1.59.0 --profile minimal
echo "::endgroup::"
echo "::group::set default toolchain"
rm -rf rust-toolchain
rustup default 1.58.1
rustup default 1.59.0
echo "::endgroup::"
echo "::group::rustup version"
rustup -Vv
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0-pre.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
license = "MIT"
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
readme = "README.md"
repository = "https://github.com/artichoke/artichoke"
documentation = "https://artichoke.github.io/artichoke/artichoke/"
Expand Down
2 changes: 1 addition & 1 deletion artichoke-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "artichoke-backend"
version = "0.10.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
description = "Embeddable VM implementation for Artichoke Ruby"
repository = "https://github.com/artichoke/artichoke"
readme = "README.md"
Expand Down
6 changes: 2 additions & 4 deletions artichoke-backend/src/extn/core/matchdata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,8 @@ impl MatchData {
Bound::Excluded(end) => self.haystack.get(end..),
Bound::Unbounded => return &[],
};
post.unwrap_or_else(|| {
// if end is out of range, there is no post match
&[]
})
// if end is out of range, there is no post match
post.unwrap_or_default()
}

#[inline]
Expand Down
4 changes: 2 additions & 2 deletions artichoke-backend/src/extn/core/regexp/backend/onig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl RegexpType for Onig {
// fallible call in `format_unicode_debug_into` is to `write!` which
// never `panic!`s for a `String` formatter, which we are using here.
let _ = format_unicode_debug_into(&mut pattern, self.source.pattern());
debug.push_str(pattern.replace("/", r"\/").as_str());
debug.push_str(pattern.replace('/', r"\/").as_str());
debug.push('/');
debug.push_str(self.source.options().as_display_modifier());
debug.push_str(self.encoding.as_modifier_str());
Expand All @@ -153,7 +153,7 @@ impl RegexpType for Onig {
let mut inspect = Vec::with_capacity(self.source.pattern().len() + 2 + 4);
inspect.push(b'/');
if let Ok(pat) = str::from_utf8(self.source.pattern()) {
inspect.extend_from_slice(pat.replace("/", r"\/").as_bytes());
inspect.extend_from_slice(pat.replace('/', r"\/").as_bytes());
} else {
inspect.extend_from_slice(self.source.pattern());
}
Expand Down
4 changes: 2 additions & 2 deletions artichoke-backend/src/extn/core/regexp/backend/regex/utf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl RegexpType for Utf8 {
// fallible call in `format_unicode_debug_into` is to `write!` which
// never `panic!`s for a `String` formatter, which we are using here.
let _ = format_unicode_debug_into(&mut pattern, self.source.pattern());
debug.push_str(pattern.replace("/", r"\/").as_str());
debug.push_str(pattern.replace('/', r"\/").as_str());
debug.push('/');
debug.push_str(self.source.options().as_display_modifier());
debug.push_str(self.encoding.as_modifier_str());
Expand All @@ -154,7 +154,7 @@ impl RegexpType for Utf8 {
let mut inspect = Vec::with_capacity(self.source.pattern().len() + 2 + 4);
inspect.push(b'/');
if let Ok(pat) = str::from_utf8(self.source.pattern()) {
inspect.extend_from_slice(pat.replace("/", r"\/").as_bytes());
inspect.extend_from_slice(pat.replace('/', r"\/").as_bytes());
} else {
inspect.extend_from_slice(self.source.pattern());
}
Expand Down
9 changes: 4 additions & 5 deletions artichoke-backend/src/extn/core/regexp/trampoline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@ pub fn initialize(
}

pub fn escape(interp: &mut Artichoke, mut pattern: Value) -> Result<Value, Error> {
let pattern_vec;
if let Ruby::Symbol = pattern.ruby_type() {
let pattern_vec = if let Ruby::Symbol = pattern.ruby_type() {
let symbol = unsafe { Symbol::unbox_from_value(&mut pattern, interp)? };
pattern_vec = symbol.bytes(interp).to_vec();
symbol.bytes(interp).to_vec()
} else {
// Safety:
//
// Convert the bytes to an owned vec to prevent the underlying `RString`
// backing `pattern` from being freed during a garbage collection.
pattern_vec = unsafe { implicitly_convert_to_string(interp, &mut pattern)?.to_vec() };
}
unsafe { implicitly_convert_to_string(interp, &mut pattern)?.to_vec() }
};
let pattern = Regexp::escape(&pattern_vec)?;
interp.try_convert_mut(pattern)
}
Expand Down
8 changes: 4 additions & 4 deletions artichoke-backend/src/extn/core/string/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,22 +270,22 @@ unsafe extern "C" fn mrb_str_equal(
str1: sys::mrb_value,
str2: sys::mrb_value,
) -> sys::mrb_bool {
unwrap_interpreter!(mrb, to => guard, or_else = false as sys::mrb_bool);
unwrap_interpreter!(mrb, to => guard, or_else = sys::mrb_bool::from(false));
let mut a = Value::from(str1);
let mut b = Value::from(str2);

let a = if let Ok(a) = String::unbox_from_value(&mut a, &mut guard) {
a
} else {
return false as sys::mrb_bool;
return sys::mrb_bool::from(false);
};
let b = if let Ok(b) = String::unbox_from_value(&mut b, &mut guard) {
b
} else {
return false as sys::mrb_bool;
return sys::mrb_bool::from(false);
};

(*a == *b) as sys::mrb_bool
sys::mrb_bool::from(*a == *b)
}

// ```c
Expand Down
1 change: 1 addition & 0 deletions artichoke-backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#![warn(clippy::cargo)]
#![allow(clippy::missing_errors_doc)]
#![allow(clippy::question_mark)] // https://github.com/rust-lang/rust-clippy/issues/8281
#![allow(clippy::unnecessary_lazy_evaluations)] // https://github.com/rust-lang/rust-clippy/issues/8109
#![cfg_attr(test, allow(clippy::non_ascii_literal))]
#![allow(unknown_lints)]
// #![warn(missing_docs)]
Expand Down
2 changes: 1 addition & 1 deletion artichoke-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "artichoke-core"
version = "0.12.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
description = "Core traits for implementing an Artichoke Ruby interpreter"
repository = "https://github.com/artichoke/artichoke"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion artichoke-load-path/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "artichoke-load-path"
version = "0.1.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
description = "Source and extension loaders for a managing a Ruby $LOAD_PATH"
repository = "https://github.com/artichoke/artichoke"
readme = "README.md"
Expand Down
5 changes: 1 addition & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ pub fn build_release_metadata(target: &Triple) {
emit("RUBY_PLATFORM", platform);
emit("RUBY_COPYRIGHT", copyright);
emit("RUBY_DESCRIPTION", description);
emit(
"ARTICHOKE_COMPILER_VERSION",
compiler_version().unwrap_or_else(String::new),
);
emit("ARTICHOKE_COMPILER_VERSION", compiler_version().unwrap_or_default());
}

fn emit<T>(env: &str, value: T)
Expand Down
2 changes: 1 addition & 1 deletion fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
license = "MIT"

[package.metadata]
Expand Down
2 changes: 1 addition & 1 deletion mezzaluna-feature-loader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "mezzaluna-feature-loader"
version = "0.4.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
description = "Source and extension loaders for a managing a Ruby $LOAD_PATH"
repository = "https://github.com/artichoke/artichoke"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.58.1
1.59.0
2 changes: 1 addition & 1 deletion scolapasta-hex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "scolapasta-hex"
version = "0.2.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
description = """
no_std hexadecimal encoding utility package for Artichoke Ruby.
"""
Expand Down
2 changes: 1 addition & 1 deletion scolapasta-string-escape/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "scolapasta-string-escape"
version = "0.2.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
description = """
String escape code and debug formatting utility package for Artichoke Ruby.
"""
Expand Down
2 changes: 1 addition & 1 deletion spec-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "spec-runner"
version = "0.6.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
description = "Binary for running Ruby Specs with Artichoke Ruby"
repository = "https://github.com/artichoke/artichoke"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion spinoso-array/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "spinoso-array"
version = "0.8.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
description = """
Growable vector backends for the Ruby Array core type in Artichoke Ruby
"""
Expand Down
2 changes: 1 addition & 1 deletion spinoso-array/src/array/smallvec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ impl<T> SmallArray<T> {
#[inline]
#[must_use]
pub fn drop_n(&self, n: usize) -> &[T] {
self.0.get(n..).unwrap_or_else(|| &[])
self.0.get(n..).unwrap_or_default()
}

/// Removes the last element from the vector and returns it, or [`None`] if
Expand Down
2 changes: 1 addition & 1 deletion spinoso-array/src/array/tinyvec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ where
#[inline]
#[must_use]
pub fn drop_n(&self, n: usize) -> &[T] {
self.0.get(n..).unwrap_or_else(|| &[])
self.0.get(n..).unwrap_or_default()
}

/// Removes the last element from the vector and returns it, or [`None`] if
Expand Down
2 changes: 1 addition & 1 deletion spinoso-array/src/array/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ impl<T> Array<T> {
#[inline]
#[must_use]
pub fn drop_n(&self, n: usize) -> &[T] {
self.0.get(n..).unwrap_or_else(|| &[])
self.0.get(n..).unwrap_or_default()
}

/// Removes the last element from the vector and returns it, or [`None`] if
Expand Down
2 changes: 1 addition & 1 deletion spinoso-env/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "spinoso-env"
version = "0.2.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
description = """
Access to environment variables, system or virtualized, for Artichoke Ruby
"""
Expand Down
2 changes: 1 addition & 1 deletion spinoso-exception/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "spinoso-exception"
version = "0.1.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
description = """
Ruby Exception error structs
"""
Expand Down
2 changes: 1 addition & 1 deletion spinoso-math/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "spinoso-math"
version = "0.2.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
description = """
Implementation of the Ruby Math module
"""
Expand Down
2 changes: 1 addition & 1 deletion spinoso-random/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "spinoso-random"
version = "0.2.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.59.0"
description = """
Implementation of Ruby Random Core class.
"""
Expand Down

0 comments on commit 672a7e8

Please sign in to comment.