reflow sub command transposes `//` and leading space
lopopolo opened this issue · comments
Describe the bug
cargo spellcheck reflow
produces bad comments.
To Reproduce
Steps to reproduce the behaviour:
- A file containing:
use std::any::Any;
use std::borrow::Cow;
use std::collections::HashSet;
use std::ffi::CStr;
use std::hash::{Hash, Hasher};
use std::ptr::NonNull;
use crate::def::{ConstantNameError, EnclosingRubyScope, Free, Method, NotDefinedError};
use crate::error::Error;
use crate::ffi::InterpreterExtractError;
use crate::method;
use crate::sys;
use crate::Artichoke;
mod registry;
pub use registry::Registry;
#[derive(Debug)]
pub struct Builder<'a> {
interp: &'a mut Artichoke,
spec: &'a Spec,
is_mrb_tt_data: bool,
super_class: Option<NonNull<sys::RClass>>,
methods: HashSet<method::Spec>,
}
impl<'a> Builder<'a> {
#[must_use]
pub fn for_spec(interp: &'a mut Artichoke, spec: &'a Spec) -> Self {
Self {
interp,
spec,
is_mrb_tt_data: false,
super_class: None,
methods: HashSet::default(),
}
}
#[must_use]
pub fn value_is_rust_object(mut self) -> Self {
self.is_mrb_tt_data = true;
self
}
pub fn with_super_class<T, U>(mut self, classname: U) -> Result<Self, Error>
where
T: Any,
U: Into<Cow<'static, str>>,
{
let state = self.interp.state.as_deref().ok_or_else(InterpreterExtractError::new)?;
let rclass = if let Some(spec) = state.classes.get::<T>() {
spec.rclass()
} else {
return Err(NotDefinedError::super_class(classname.into()).into());
};
let rclass = unsafe { self.interp.with_ffi_boundary(|mrb| rclass.resolve(mrb))? };
if let Some(rclass) = rclass {
self.super_class = Some(rclass);
Ok(self)
} else {
Err(NotDefinedError::super_class(classname.into()).into())
}
}
pub fn add_method<T>(mut self, name: T, method: Method, args: sys::mrb_aspec) -> Result<Self, ConstantNameError>
where
T: Into<Cow<'static, str>>,
{
let spec = method::Spec::new(method::Type::Instance, name.into(), method, args)?;
self.methods.insert(spec);
Ok(self)
}
pub fn add_self_method<T>(
mut self,
name: T,
method: Method,
args: sys::mrb_aspec,
) -> Result<Self, ConstantNameError>
where
T: Into<Cow<'static, str>>,
{
let spec = method::Spec::new(method::Type::Class, name.into(), method, args)?;
self.methods.insert(spec);
Ok(self)
}
pub fn define(self) -> Result<(), NotDefinedError> {
use sys::mrb_vtype::MRB_TT_DATA;
let name = self.spec.name_c_str().as_ptr();
let mut super_class = if let Some(super_class) = self.super_class {
super_class
} else {
// SAFETY: Although this direct access of the `mrb` property on the
// interp does not go through `Artichoke::with_ffi_boundary`, no
// `MRB_API` functions are called, which means it is not required to
// re-box the Artichoke `State` into the `mrb_state->ud` pointer.
//
// This code only performs a memory access to read a field from the
// `mrb_state`.
let rclass = unsafe { self.interp.mrb.as_ref().object_class };
NonNull::new(rclass).ok_or_else(|| NotDefinedError::super_class("Object"))?
};
let rclass = self.spec.rclass();
let rclass = unsafe { self.interp.with_ffi_boundary(|mrb| rclass.resolve(mrb)) };
let mut rclass = if let Ok(Some(rclass)) = rclass {
rclass
} else if let Some(enclosing_scope) = self.spec.enclosing_scope() {
let scope = unsafe { self.interp.with_ffi_boundary(|mrb| enclosing_scope.rclass(mrb)) };
if let Ok(Some(mut scope)) = scope {
let rclass = unsafe {
self.interp.with_ffi_boundary(|mrb| {
sys::mrb_define_class_under(mrb, scope.as_mut(), name, super_class.as_mut())
})
};
let rclass = rclass.map_err(|_| NotDefinedError::class(self.spec.name()))?;
NonNull::new(rclass).ok_or_else(|| NotDefinedError::class(self.spec.name()))?
} else {
return Err(NotDefinedError::enclosing_scope(enclosing_scope.fqname().into_owned()));
}
} else {
let rclass = unsafe {
self.interp
.with_ffi_boundary(|mrb| sys::mrb_define_class(mrb, name, super_class.as_mut()))
};
let rclass = rclass.map_err(|_| NotDefinedError::class(self.spec.name()))?;
NonNull::new(rclass).ok_or_else(|| NotDefinedError::class(self.spec.name()))?
};
for method in &self.methods {
unsafe {
method.define(self.interp, rclass.as_mut())?;
}
}
// If a `Spec` defines a `Class` whose instances own a pointer to a
// Rust object, mark them as `MRB_TT_DATA`.
if self.is_mrb_tt_data {
unsafe {
sys::mrb_sys_set_instance_tt(rclass.as_mut(), MRB_TT_DATA);
}
}
Ok(())
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Rclass {
name: &'static CStr,
enclosing_scope: Option<EnclosingRubyScope>,
}
impl Rclass {
#[must_use]
pub const fn new(name: &'static CStr, enclosing_scope: Option<EnclosingRubyScope>) -> Self {
Self { name, enclosing_scope }
}
/// Resolve a type's [`sys::RClass`] using its enclosing scope and name.
///
/// # Safety
///
/// This function must be called within an [`Artichoke::with_ffi_boundary`]
/// closure because the FFI APIs called in this function may require access
/// to the Artichoke [`State`](crate::state::State).
pub unsafe fn resolve(&self, mrb: *mut sys::mrb_state) -> Option<NonNull<sys::RClass>> {
let class_name = self.name.as_ptr();
if let Some(ref scope) = self.enclosing_scope {
// short circuit if enclosing scope does not exist.
let mut scope = scope.rclass(mrb)?;
let is_defined_under = sys::mrb_class_defined_under(mrb, scope.as_mut(), class_name);
if is_defined_under {
// Enclosing scope exists.
// Class is defined under the enclosing scope.
let class = sys::mrb_class_get_under(mrb, scope.as_mut(), class_name);
NonNull::new(class)
} else {
// Enclosing scope exists.
// Class is not defined under the enclosing scope.
None
}
} else {
let is_defined = sys::mrb_class_defined(mrb, class_name);
if is_defined {
// Class exists in root scope.
let class = sys::mrb_class_get(mrb, class_name);
NonNull::new(class)
} else {
// Class does not exist in root scope.
None
}
}
}
}
#[derive(Debug)]
pub struct Spec {
name: Cow<'static, str>,
name_cstr: &'static CStr,
data_type: Box<sys::mrb_data_type>,
enclosing_scope: Option<EnclosingRubyScope>,
}
impl Spec {
pub fn new<T>(
name: T,
name_cstr: &'static CStr,
enclosing_scope: Option<EnclosingRubyScope>,
free: Option<Free>,
) -> Result<Self, ConstantNameError>
where
T: Into<Cow<'static, str>>,
{
let name = name.into();
// SAFETY: The constructed `mrb_data_type` has `'static` lifetime:
//
// - `name_cstr` is `&'static` so it will outlive the `data_type`.
// - `Spec` does not offer mutable access to these fields.
let data_type = sys::mrb_data_type {
struct_name: name_cstr.as_ptr(),
dfree: free,
};
let data_type = Box::new(data_type);
Ok(Self {
name,
name_cstr,
data_type,
enclosing_scope,
})
}
#[must_use]
pub fn data_type(&self) -> *const sys::mrb_data_type {
self.data_type.as_ref()
}
#[must_use]
pub fn name(&self) -> Cow<'static, str> {
match &self.name {
Cow::Borrowed(name) => Cow::Borrowed(name),
Cow::Owned(name) => name.clone().into(),
}
}
#[must_use]
pub fn name_c_str(&self) -> &'static CStr {
self.name_cstr
}
#[must_use]
pub fn enclosing_scope(&self) -> Option<&EnclosingRubyScope> {
self.enclosing_scope.as_ref()
}
#[must_use]
pub fn fqname(&self) -> Cow<'_, str> {
if let Some(scope) = self.enclosing_scope() {
let mut fqname = String::from(scope.fqname());
fqname.push_str("::");
fqname.push_str(self.name.as_ref());
fqname.into()
} else {
self.name.as_ref().into()
}
}
#[must_use]
pub fn rclass(&self) -> Rclass {
Rclass::new(self.name_cstr, self.enclosing_scope.clone())
}
}
impl Hash for Spec {
fn hash<H: Hasher>(&self, state: &mut H) {
self.name().hash(state);
self.enclosing_scope().hash(state);
}
}
impl Eq for Spec {}
impl PartialEq for Spec {
fn eq(&self, other: &Self) -> bool {
self.fqname() == other.fqname()
}
}
#[cfg(test)]
mod tests {
use spinoso_exception::StandardError;
use crate::extn::core::kernel::Kernel;
use crate::test::prelude::*;
struct RustError;
#[test]
fn super_class() {
let mut interp = interpreter();
let spec = class::Spec::new("RustError", qed::const_cstr_from_str!("RustError\0"), None, None).unwrap();
class::Builder::for_spec(&mut interp, &spec)
.with_super_class::<StandardError, _>("StandardError")
.unwrap()
.define()
.unwrap();
interp.def_class::<RustError>(spec).unwrap();
let result = interp.eval(b"RustError.new.is_a?(StandardError)").unwrap();
let result = result.try_convert_into::<bool>(&interp).unwrap();
assert!(result, "RustError instances are instance of StandardError");
let result = interp.eval(b"RustError < StandardError").unwrap();
let result = result.try_convert_into::<bool>(&interp).unwrap();
assert!(result, "RustError inherits from StandardError");
}
#[test]
fn rclass_for_undef_root_class() {
let mut interp = interpreter();
let spec = class::Spec::new("Foo", qed::const_cstr_from_str!("Foo\0"), None, None).unwrap();
let rclass = unsafe { interp.with_ffi_boundary(|mrb| spec.rclass().resolve(mrb)) }.unwrap();
assert!(rclass.is_none());
}
#[test]
fn rclass_for_undef_nested_class() {
let mut interp = interpreter();
let scope = interp.module_spec::<Kernel>().unwrap().unwrap();
let spec = class::Spec::new(
"Foo",
qed::const_cstr_from_str!("Foo\0"),
Some(EnclosingRubyScope::module(scope)),
None,
)
.unwrap();
let rclass = unsafe { interp.with_ffi_boundary(|mrb| spec.rclass().resolve(mrb)) }.unwrap();
assert!(rclass.is_none());
}
#[test]
fn rclass_for_nested_class() {
let mut interp = interpreter();
interp.eval(b"module Foo; class Bar; end; end").unwrap();
let spec = module::Spec::new(&mut interp, "Foo", qed::const_cstr_from_str!("Foo\0"), None).unwrap();
let spec = class::Spec::new(
"Bar",
qed::const_cstr_from_str!("Bar\0"),
Some(EnclosingRubyScope::module(&spec)),
None,
)
.unwrap();
let rclass = unsafe { interp.with_ffi_boundary(|mrb| spec.rclass().resolve(mrb)) }.unwrap();
assert!(rclass.is_some());
}
#[test]
fn rclass_for_nested_class_under_class() {
let mut interp = interpreter();
interp.eval(b"class Foo; class Bar; end; end").unwrap();
let spec = class::Spec::new("Foo", qed::const_cstr_from_str!("Foo\0"), None, None).unwrap();
let spec = class::Spec::new(
"Bar",
qed::const_cstr_from_str!("Bar\0"),
Some(EnclosingRubyScope::class(&spec)),
None,
)
.unwrap();
let rclass = unsafe { interp.with_ffi_boundary(|mrb| spec.rclass().resolve(mrb)) }.unwrap();
assert!(rclass.is_some());
}
}
- Run
cargo spellcheck reflow
- Observe this malformed diff:
diff --git i/artichoke-backend/src/class.rs w/artichoke-backend/src/class.rs
index 941b22a09c..42f4a3a881 100644
--- i/artichoke-backend/src/class.rs
+++ w/artichoke-backend/src/class.rs
@@ -138,8 +138,8 @@ impl<'a> Builder<'a> {
}
}
- // If a `Spec` defines a `Class` whose instances own a pointer to a
- // Rust object, mark them as `MRB_TT_DATA`.
+ // If a `Spec` defines a `Class` whose instances own a pointer to a Rust
+ //object, mark them as `MRB_TT_DATA`.
if self.is_mrb_tt_data {
unsafe {
sys::mrb_sys_set_instance_tt(rclass.as_mut(), MRB_TT_DATA);
@@ -175,13 +175,13 @@ impl Rclass {
let mut scope = scope.rclass(mrb)?;
let is_defined_under = sys::mrb_class_defined_under(mrb, scope.as_mut(), class_name);
if is_defined_under {
- // Enclosing scope exists.
- // Class is defined under the enclosing scope.
+ // Enclosing scope exists. Class is defined under the enclosing
+ //scope.
let class = sys::mrb_class_get_under(mrb, scope.as_mut(), class_name);
NonNull::new(class)
} else {
- // Enclosing scope exists.
- // Class is not defined under the enclosing scope.
+ // Enclosing scope exists. Class is not defined under the
+ //enclosing scope.
None
}
} else {
Expected behavior
No extra space before comment on second line, a space after the //
.
Screenshots
Please complete the following information:
- System: macOS
- Obtained: cargo
- Version: cargo-spellcheck 0.11.3
Additional context
Does it only happen with two line comments?
#238 could be related
@drahnr from a quick peek, it occurs in more places than just two line comments. This one is such an example:
diff --git i/artichoke-backend/src/def.rs w/artichoke-backend/src/def.rs
index 9d1a766659..82963c879e 100644
--- i/artichoke-backend/src/def.rs
+++ w/artichoke-backend/src/def.rs
@@ -54,10 +54,10 @@ where
// Rather than attempt a free and virtually guaranteed segfault, log
// loudly and short-circuit; a leak is better than a crash.
//
- // `box_unbox_free::<T>` is only ever called in an FFI context when
- // there are C frames in the stack. Using `eprintln!` or unwrapping the
- // error from `write!` here is undefined behavior and may result in an
- // abort. Instead, suppress the error.
+ // `box_unbox_free::<T>` is only ever called in an FFI context when there
+ //are C frames in the stack. Using `eprintln!` or unwrapping the error
+ //from `write!` here is undefined behavior and may result in an abort.
+ //Instead, suppress the error.
let _ignored = write!(
io::stderr(),
"Received null pointer in box_unbox_free::<{}>",
Full diff
diff --git i/README.md w/README.md
index 69faaff23a..a6dbbd3053 100644
--- i/README.md
+++ w/README.md
@@ -135,10 +135,10 @@ If Artichoke does not run Ruby source code in the same way that MRI does, it is
a bug and we would appreciate if you [filed an issue so we can fix
it][file-an-issue].
-If you would like to contribute code 👩💻👨💻, find an issue that looks interesting
-and leave a comment that you're beginning to investigate. If there is no issue,
-please file one before beginning to work on a PR. [Good first issues are labeled
-`E-easy`][e-easy].
+If you would like to contribute code 👩💻👨💻, find an issue that looks
+interesting and leave a comment that you're beginning to investigate. If there
+is no issue, please file one before beginning to work on a PR. [Good first
+issues are labeled `E-easy`][e-easy].
### Discussion
diff --git i/artichoke-backend/src/class.rs w/artichoke-backend/src/class.rs
index 840e98fdc3..d65a201c31 100644
--- i/artichoke-backend/src/class.rs
+++ w/artichoke-backend/src/class.rs
@@ -138,8 +138,8 @@ impl<'a> Builder<'a> {
}
}
- // If a `Spec` defines a `Class` whose instances own a pointer to a
- // Rust object, mark them as `MRB_TT_DATA`.
+ // If a `Spec` defines a `Class` whose instances own a pointer to a Rust
+ //object, mark them as `MRB_TT_DATA`.
if self.is_mrb_tt_data {
unsafe {
sys::mrb_sys_set_instance_tt(rclass.as_mut(), MRB_TT_DATA);
@@ -175,13 +175,13 @@ impl Rclass {
let mut scope = scope.rclass(mrb)?;
let is_defined_under = sys::mrb_class_defined_under(mrb, scope.as_mut(), class_name);
if is_defined_under {
- // Enclosing scope exists.
- // Class is defined under the enclosing scope.
+ // Enclosing scope exists. Class is defined under the enclosing
+ //scope.
let class = sys::mrb_class_get_under(mrb, scope.as_mut(), class_name);
NonNull::new(class)
} else {
- // Enclosing scope exists.
- // Class is not defined under the enclosing scope.
+ // Enclosing scope exists. Class is not defined under the
+ //enclosing scope.
None
}
} else {
diff --git i/artichoke-backend/src/class/registry.rs w/artichoke-backend/src/class/registry.rs
index 2244c18b67..6369f1448e 100644
--- i/artichoke-backend/src/class/registry.rs
+++ w/artichoke-backend/src/class/registry.rs
@@ -233,9 +233,8 @@ where
self.0.shrink_to_fit();
}
- /// Shrinks the capacity of the registry with a lower bound.
- /// The capacity will remain at least as large as both the length and the
- /// supplied value.
+ /// Shrinks the capacity of the registry with a lower bound. The capacity
+ /// will remain at least as large as both the length and the supplied value.
///
/// If the current capacity is less than the lower limit, this is a no-op.
pub fn shrink_to(&mut self, min_capacity: usize) {
diff --git i/artichoke-backend/src/def.rs w/artichoke-backend/src/def.rs
index 9d1a766659..82963c879e 100644
--- i/artichoke-backend/src/def.rs
+++ w/artichoke-backend/src/def.rs
@@ -54,10 +54,10 @@ where
// Rather than attempt a free and virtually guaranteed segfault, log
// loudly and short-circuit; a leak is better than a crash.
//
- // `box_unbox_free::<T>` is only ever called in an FFI context when
- // there are C frames in the stack. Using `eprintln!` or unwrapping the
- // error from `write!` here is undefined behavior and may result in an
- // abort. Instead, suppress the error.
+ // `box_unbox_free::<T>` is only ever called in an FFI context when there
+ //are C frames in the stack. Using `eprintln!` or unwrapping the error
+ //from `write!` here is undefined behavior and may result in an abort.
+ //Instead, suppress the error.
let _ignored = write!(
io::stderr(),
"Received null pointer in box_unbox_free::<{}>",
@@ -120,9 +120,9 @@ pub struct ModuleScope {
/// Typesafe wrapper for the [`RClass *`](sys::RClass) of the enclosing scope
/// for an mruby `Module` or `Class`.
///
-/// In Ruby, classes and modules can be defined inside another class or
-/// module. mruby only supports resolving [`RClass`](sys::RClass) pointers
-/// relative to an enclosing scope. This can be the top level with
+/// In Ruby, classes and modules can be defined inside another class or module.
+/// mruby only supports resolving [`RClass`](sys::RClass) pointers relative to
+/// an enclosing scope. This can be the top level with
/// [`mrb_class_get`](sys::mrb_class_get) and
/// [`mrb_module_get`](sys::mrb_module_get) or it can be under another class
/// with [`mrb_class_get_under`](sys::mrb_class_get_under) or module with
diff --git i/artichoke-backend/src/error.rs w/artichoke-backend/src/error.rs
index a64747ceba..95d097dbe9 100644
--- i/artichoke-backend/src/error.rs
+++ w/artichoke-backend/src/error.rs
@@ -97,9 +97,9 @@ where
// `mrb_exc_raise` will call longjmp which will unwind the stack.
sys::mrb_exc_raise(mrb, exc);
- // SAFETY: This line is unreachable because `raise` will unwind the
- // stack with `longjmp` when calling `sys::mrb_exc_raise` in the
- // preceding line.
+ // SAFETY: This line is unreachable because `raise` will unwind the stack
+ //with `longjmp` when calling `sys::mrb_exc_raise` in the preceding
+ //line.
hint::unreachable_unchecked()
}
@@ -107,8 +107,8 @@ where
// log loudly to stderr and attempt to fallback to a runtime error.
emit_fatal_warning!("Unable to raise exception: {:?}", exception);
- // Any non-`Copy` objects that we haven't cleaned up at this point will
- // leak, so drop everything.
+ // Any non-`Copy` objects that we haven't cleaned up at this point will leak,
+ //so drop everything.
drop(exception);
// `mrb_sys_raise` will call longjmp which will unwind the stack.
diff --git i/artichoke-backend/src/exception_handler.rs w/artichoke-backend/src/exception_handler.rs
index c4d3dd2759..cd65f63061 100644
--- i/artichoke-backend/src/exception_handler.rs
+++ w/artichoke-backend/src/exception_handler.rs
@@ -130,14 +130,13 @@ impl From<CaughtException> for Error {
pub fn last_error(interp: &mut Artichoke, exception: Value) -> Result<Error, Error> {
let mut arena = interp.create_arena_savepoint()?;
- // Clear the current exception from the mruby interpreter so subsequent
- // calls to the mruby VM are not tainted by an error they did not
- // generate.
+ // Clear the current exception from the mruby interpreter so subsequent calls
+ //to the mruby VM are not tainted by an error they did not generate.
//
- // We must clear the pointer at the beginning of this function so we can
- // use the mruby VM to inspect the exception once we turn it into an
- // `mrb_value`. `Value::funcall` handles errors by calling this
- // function, so not clearing the exception results in a stack overflow.
+ // We must clear the pointer at the beginning of this function so we can use
+ //the mruby VM to inspect the exception once we turn it into an `mrb_value`.
+ //`Value::funcall` handles errors by calling this function, so not clearing
+ //the exception results in a stack overflow.
// Generate exception metadata in by executing the Ruby code:
//
@@ -146,11 +145,11 @@ pub fn last_error(interp: &mut Artichoke, exception: Value) -> Result<Error, Err
// message = exception.message
// ```
- // Sometimes when hacking on `extn/core` it is possible to enter a
- // crash loop where an exception is captured by this handler, but
- // extracting the exception name or backtrace throws again.
- // Un-commenting the following print statement will at least get you the
- // exception class and message, which should help debugging.
+ // Sometimes when hacking on `extn/core` it is possible to enter a crash loop
+ //where an exception is captured by this handler, but extracting the
+ //exception name or backtrace throws again. Un-commenting the following
+ //print statement will at least get you the exception class and message,
+ //which should help debugging.
//
// ```
// let message = exception.funcall(&mut arena, "message", &[], None)?;
diff --git i/artichoke-backend/src/extn/core/array/mod.rs w/artichoke-backend/src/extn/core/array/mod.rs
index 21262148db..f2709adabc 100644
--- i/artichoke-backend/src/extn/core/array/mod.rs
+++ w/artichoke-backend/src/extn/core/array/mod.rs
@@ -265,9 +265,9 @@ impl BoxUnboxVmValue for Array {
// SAFETY: `Array` is backed by a `Vec` which can allocate at
// most `isize::MAX` bytes.
//
- // `mrb_value` is not a ZST, so in practice, `len` and
- // `capacity` will never overflow `mrb_int`, which is an `i64`
- // on 64-bit targets.
+ // `mrb_value` is not a ZST, so in practice, `len` and `capacity`
+ //will never overflow `mrb_int`, which is an `i64` on 64-bit
+ //targets.
//
// On 32-bit targets, `usize` is `u32` which will never overflow
// `i64`. Artichoke unconditionally compiles mruby with `-DMRB_INT64`.
diff --git i/artichoke-backend/src/extn/core/array/trampoline.rs w/artichoke-backend/src/extn/core/array/trampoline.rs
index 04a0992e72..0d9526a38d 100644
--- i/artichoke-backend/src/extn/core/array/trampoline.rs
+++ w/artichoke-backend/src/extn/core/array/trampoline.rs
@@ -228,9 +228,9 @@ pub fn initialize(
second: Option<Value>,
block: Option<Block>,
) -> Result<Value, Error> {
- // Pack an empty `Array` into the given uninitialized `RArray *` so it can
- // be safely marked if an mruby allocation occurs and a GC is triggered in
- // `Array::initialize`.
+ // Pack an empty `Array` into the given uninitialized `RArray *` so it can be
+ //safely marked if an mruby allocation occurs and a GC is triggered in
+ //`Array::initialize`.
//
// Allocations are likely in the case where a block is passed to
// `Array#initialize` or when the first and second args must be coerced with
@@ -241,9 +241,9 @@ pub fn initialize(
}
pub fn initialize_copy(interp: &mut Artichoke, ary: Value, mut from: Value) -> Result<Value, Error> {
- // Pack an empty `Array` into the given uninitialized `RArray *` so it can
- // be safely marked if an mruby allocation occurs and a GC is triggered in
- // `Array::initialize`.
+ // Pack an empty `Array` into the given uninitialized `RArray *` so it can be
+ //safely marked if an mruby allocation occurs and a GC is triggered in
+ //`Array::initialize`.
//
// This ensures the given `RArry *` is initialized even if a non-`Array`
// object is called with `Array#initialize_copy` and the
@@ -314,8 +314,8 @@ pub fn reverse_bang(interp: &mut Artichoke, mut ary: Value) -> Result<Value, Err
}
let mut array = unsafe { Array::unbox_from_value(&mut ary, interp)? };
- // SAFETY: Reversing an `Array` in place does not reallocate it. The array
- // is repacked without any intervening interpreter heap allocations.
+ // SAFETY: Reversing an `Array` in place does not reallocate it. The array is
+ //repacked without any intervening interpreter heap allocations.
unsafe {
let array_mut = array.as_inner_mut();
array_mut.reverse();
@@ -346,8 +346,8 @@ pub fn shift(interp: &mut Artichoke, mut ary: Value, count: Option<Value>) -> Re
// garbage collection, otherwise marking the children in `ary` will have
// undefined behavior.
//
- // The call to `Array::alloc_value` happens outside this block after
- // the `Array` has been repacked.
+ // The call to `Array::alloc_value` happens outside this block after the
+ //`Array` has been repacked.
let shifted = unsafe {
let array_mut = array.as_inner_mut();
let shifted = array_mut.shift_n(count);
@@ -360,8 +360,8 @@ pub fn shift(interp: &mut Artichoke, mut ary: Value, count: Option<Value>) -> Re
Array::alloc_value(shifted, interp)
} else {
- // SAFETY: The call to `Array::shift` will potentially invalidate the
- // raw parts stored in `ary`'s `RArray*`.
+ // SAFETY: The call to `Array::shift` will potentially invalidate the raw
+ //parts stored in `ary`'s `RArray*`.
//
// The raw parts in `ary`'s `RArray *` must be repacked before a
// potential garbage collection, otherwise marking the children in `ary`
diff --git i/artichoke-backend/src/extn/core/array/wrapper.rs w/artichoke-backend/src/extn/core/array/wrapper.rs
index 96f1e98087..d871d3a39e 100644
--- i/artichoke-backend/src/extn/core/array/wrapper.rs
+++ w/artichoke-backend/src/extn/core/array/wrapper.rs
@@ -397,7 +397,7 @@ impl Array {
/// Returns a reference to an element at the index.
///
- /// Unlike [`Vec`], this method does not support indexing with a range. See
+ /// Unlike [`Vec`], this method does not support indexing with a range. See
/// the [`slice`](Self::slice) method for retrieving a sub-slice from the
/// array.
#[inline]
diff --git i/artichoke-backend/src/extn/core/float/mod.rs w/artichoke-backend/src/extn/core/float/mod.rs
index c2ab5259a2..e74b685da5 100644
--- i/artichoke-backend/src/extn/core/float/mod.rs
+++ w/artichoke-backend/src/extn/core/float/mod.rs
@@ -146,13 +146,10 @@ impl Float {
///
/// Other modes include:
///
- /// | mode | value |
- /// |------------------------------------|-------|
- /// | Indeterminable | -1 |
- /// | Rounding towards zero | 0 |
- /// | Rounding to the nearest number | 1 |
- /// | Rounding towards positive infinity | 2 |
- /// | Rounding towards negative infinity | 3 |
+ /// | mode | value | |------------------------------------|-------| |
+ /// Indeterminable | -1 | | Rounding towards zero | 0 | | Rounding to the
+ /// nearest number | 1 | | Rounding towards positive infinity | 2 | |
+ /// Rounding towards negative infinity | 3 |
///
/// # Rust Caveats
///
diff --git i/artichoke-backend/src/extn/core/integer/mod.rs w/artichoke-backend/src/extn/core/integer/mod.rs
index 3e64dad9f1..413d84f54c 100644
--- i/artichoke-backend/src/extn/core/integer/mod.rs
+++ w/artichoke-backend/src/extn/core/integer/mod.rs
@@ -104,8 +104,8 @@ impl Integer {
message.extend_from_slice(b") not supported");
Err(NotImplementedError::from(message).into())
} else {
- // When no encoding is supplied, MRI assumes the encoding is
- // either ASCII or ASCII-8BIT.
+ // When no encoding is supplied, MRI assumes the encoding is either
+ //ASCII or ASCII-8BIT.
//
// - `Integer`s from 0..127 result in a `String` with ASCII
// encoding.
@@ -283,7 +283,8 @@ mod tests {
let expected = -i64::from(x) / i64::from(y);
quotient == expected
} else {
- // Round negative integer division toward negative infinity.
+ // Round negative integer division toward negative
+ //infinity.
let expected = (-i64::from(x) / i64::from(y)) - 1;
quotient == expected
}
@@ -311,7 +312,8 @@ mod tests {
let expected = -i64::from(x) / i64::from(y);
quotient == expected
} else {
- // Round negative integer division toward negative infinity.
+ // Round negative integer division toward negative
+ //infinity.
let expected = (-i64::from(x) / i64::from(y)) - 1;
quotient == expected
}
diff --git i/artichoke-backend/src/extn/core/kernel/require.rs w/artichoke-backend/src/extn/core/kernel/require.rs
index 24814f818f..710d7a673a 100644
--- i/artichoke-backend/src/extn/core/kernel/require.rs
+++ w/artichoke-backend/src/extn/core/kernel/require.rs
@@ -1,4 +1,4 @@
-//! [`Kernel#require`](https://ruby-doc.org/core-3.1.2/Kernel.html#method-i-require)
+//! //! [`Kernel#require`](https://ruby-doc.org/core-3.1.2/Kernel.html#method-i-require)
use std::path::{Path, PathBuf};
@@ -11,9 +11,9 @@ use crate::extn::prelude::*;
use crate::state::parser::Context;
pub fn load(interp: &mut Artichoke, mut filename: Value) -> Result<Loaded, Error> {
- // SAFETY: The extracted byte slice is converted to an owned `Vec<u8>`
- // before the interpreter is used again which protects against a garbage
- // collection invalidating the pointer.
+ // SAFETY: The extracted byte slice is converted to an owned `Vec<u8>` before
+ //the interpreter is used again which protects against a garbage collection
+ //invalidating the pointer.
let filename = unsafe { implicitly_convert_to_string(interp, &mut filename)? };
if filename.find_byte(b'\0').is_some() {
return Err(ArgumentError::with_message("path name contains null byte").into());
@@ -41,9 +41,9 @@ pub fn load(interp: &mut Artichoke, mut filename: Value) -> Result<Loaded, Error
}
pub fn require(interp: &mut Artichoke, mut filename: Value) -> Result<Required, Error> {
- // SAFETY: The extracted byte slice is converted to an owned `Vec<u8>`
- // before the interpreter is used again which protects against a garbage
- // collection invalidating the pointer.
+ // SAFETY: The extracted byte slice is converted to an owned `Vec<u8>` before
+ //the interpreter is used again which protects against a garbage collection
+ //invalidating the pointer.
let filename = unsafe { implicitly_convert_to_string(interp, &mut filename)? };
if filename.find_byte(b'\0').is_some() {
return Err(ArgumentError::with_message("path name contains null byte").into());
@@ -72,9 +72,9 @@ pub fn require(interp: &mut Artichoke, mut filename: Value) -> Result<Required,
#[allow(clippy::module_name_repetitions)]
pub fn require_relative(interp: &mut Artichoke, mut filename: Value, base: RelativePath) -> Result<Required, Error> {
- // SAFETY: The extracted byte slice is converted to an owned `Vec<u8>`
- // before the interpreter is used again which protects against a garbage
- // collection invalidating the pointer.
+ // SAFETY: The extracted byte slice is converted to an owned `Vec<u8>` before
+ //the interpreter is used again which protects against a garbage collection
+ //invalidating the pointer.
let filename = unsafe { implicitly_convert_to_string(interp, &mut filename)? };
if filename.find_byte(b'\0').is_some() {
return Err(ArgumentError::with_message("path name contains null byte").into());
diff --git i/artichoke-backend/src/extn/core/kernel/trampoline.rs w/artichoke-backend/src/extn/core/kernel/trampoline.rs
index 028784a1c8..d672da7a33 100644
--- i/artichoke-backend/src/extn/core/kernel/trampoline.rs
+++ w/artichoke-backend/src/extn/core/kernel/trampoline.rs
@@ -54,8 +54,8 @@ pub fn integer(interp: &mut Artichoke, mut val: Value, base: Option<Value>) -> R
// https://github.com/ruby/ruby/blob/v3_1_2/object.c#L3127-L3132
if let Ok(f) = val.try_convert_into::<f64>(interp) {
- // TODO: handle exception kwarg and return `nil` if it is false and f is not finite.
- // https://github.com/ruby/ruby/blob/v3_1_2/object.c#L3129
+ // TODO: handle exception kwarg and return `nil` if it is false and f is
+ //not finite. https://github.com/ruby/ruby/blob/v3_1_2/object.c#L3129
// https://github.com/ruby/ruby/blob/v3_1_2/object.c#L3131
// https://github.com/ruby/ruby/blob/v3_1_2/bignum.c#L5230-L5235
diff --git i/artichoke-backend/src/extn/core/matchdata/trampoline.rs w/artichoke-backend/src/extn/core/matchdata/trampoline.rs
index 33bbe9808b..1510e4564a 100644
--- i/artichoke-backend/src/extn/core/matchdata/trampoline.rs
+++ w/artichoke-backend/src/extn/core/matchdata/trampoline.rs
@@ -123,8 +123,8 @@ pub fn element_reference(
return interp.try_convert_mut(matched);
}
- // NOTE(lopopolo): Encapsulation is broken here by reaching into the
- // inner regexp.
+ // NOTE(lopopolo): Encapsulation is broken here by reaching into the inner
+ //regexp.
let captures_len = data.regexp.inner().captures_len(None)?;
let rangelen = i64::try_from(captures_len).map_err(|_| ArgumentError::with_message("input string too long"))?;
let at = match elem.is_range(interp, rangelen)? {
diff --git i/artichoke-backend/src/extn/core/math/trampoline.rs w/artichoke-backend/src/extn/core/math/trampoline.rs
index ebb7a90bf6..3d22c757b9 100644
--- i/artichoke-backend/src/extn/core/math/trampoline.rs
+++ w/artichoke-backend/src/extn/core/math/trampoline.rs
@@ -114,8 +114,8 @@ pub fn ldexp(interp: &mut Artichoke, fraction: Value, exponent: Value) -> Result
return Err(RangeError::with_message("float NaN out of range of integer").into());
}
Err(Ok(exp)) => {
- // This saturating cast will be rejected by the `i32::try_from`
- // below if `exp` is too large.
+ // This saturating cast will be rejected by the `i32::try_from` below
+ //if `exp` is too large.
exp as i64
}
Err(Err(err)) => return Err(err),
diff --git i/artichoke-backend/src/extn/core/numeric/mod.rs w/artichoke-backend/src/extn/core/numeric/mod.rs
index eaa6c68b01..7b5c8cc843 100644
--- i/artichoke-backend/src/extn/core/numeric/mod.rs
+++ w/artichoke-backend/src/extn/core/numeric/mod.rs
@@ -42,8 +42,8 @@ pub enum Coercion {
///
/// # Coercion enum
///
-/// Artichoke represents the `[y, x]` tuple Array as the [`Coercion`] enum, which
-/// orders its values `Coercion::Integer(x, y)`.
+/// Artichoke represents the `[y, x]` tuple Array as the [`Coercion`] enum,
+/// which orders its values `Coercion::Integer(x, y)`.
///
/// [numeric]: https://ruby-doc.org/core-3.1.2/Numeric.html#method-i-coerce
pub fn coerce(interp: &mut Artichoke, x: Value, y: Value) -> Result<Coercion, Error> {
diff --git i/artichoke-backend/src/extn/core/regexp/backend/onig.rs w/artichoke-backend/src/extn/core/regexp/backend/onig.rs
index 58767984dd..45e08ef1ec 100644
--- i/artichoke-backend/src/extn/core/regexp/backend/onig.rs
+++ w/artichoke-backend/src/extn/core/regexp/backend/onig.rs
@@ -118,9 +118,9 @@ impl RegexpType for Onig {
// Explicitly suppress this error because `debug` is infallible and
// cannot panic.
//
- // In practice this error will never be triggered since the only
- // fallible call in `format_debug_escape_into` is to `write!` which
- // never `panic!`s for a `String` formatter, which we are using here.
+ // In practice this error will never be triggered since the only fallible
+ //call in `format_debug_escape_into` is to `write!` which never
+ //`panic!`s for a `String` formatter, which we are using here.
let _ = format_debug_escape_into(&mut pattern, self.source.pattern());
debug.push_str(pattern.replace('/', r"\/").as_str());
debug.push('/');
diff --git i/artichoke-backend/src/extn/core/regexp/backend/regex/mod.rs w/artichoke-backend/src/extn/core/regexp/backend/regex/mod.rs
index 05ec97e933..f7e7dfcc58 100644
--- i/artichoke-backend/src/extn/core/regexp/backend/regex/mod.rs
+++ w/artichoke-backend/src/extn/core/regexp/backend/regex/mod.rs
@@ -1,3 +1,3 @@
-// TODO(GH-490): Add `regex::Binary` implementation of `RegexType`.
-// pub mod binary;
+// TODO(GH-490): Add `regex::Binary` implementation of `RegexType`. pub mod
+ //binary;
pub mod utf8;
diff --git i/artichoke-backend/src/extn/core/regexp/backend/regex/utf8.rs w/artichoke-backend/src/extn/core/regexp/backend/regex/utf8.rs
index 0e52f3bf0f..6ec8d9b1a5 100644
--- i/artichoke-backend/src/extn/core/regexp/backend/regex/utf8.rs
+++ w/artichoke-backend/src/extn/core/regexp/backend/regex/utf8.rs
@@ -127,9 +127,9 @@ impl RegexpType for Utf8 {
// Explicitly suppress this error because `debug` is infallible and
// cannot panic.
//
- // In practice this error will never be triggered since the only
- // fallible call in `format_debug_escape_into` is to `write!` which
- // never `panic!`s for a `String` formatter, which we are using here.
+ // In practice this error will never be triggered since the only fallible
+ //call in `format_debug_escape_into` is to `write!` which never
+ //`panic!`s for a `String` formatter, which we are using here.
let _ = format_debug_escape_into(&mut pattern, self.source.pattern());
debug.push_str(pattern.replace('/', r"\/").as_str());
debug.push('/');
@@ -177,8 +177,8 @@ impl RegexpType for Utf8 {
if let Some(captures) = self.regex.captures(haystack) {
// per the [docs] for `captures.len()`:
//
- // > This is always at least 1, since every regex has at least one
- // > capture group that corresponds to the full match.
+ // > This is always at least 1, since every regex has at least one >
+ //capture group that corresponds to the full match.
//
// [docs]: https://docs.rs/regex/1.3.4/regex/struct.Captures.html#method.len
interp.set_active_regexp_globals(captures.len().checked_sub(1).unwrap_or_default())?;
@@ -259,8 +259,8 @@ impl RegexpType for Utf8 {
if let Some(captures) = self.regex.captures(target) {
// per the [docs] for `captures.len()`:
//
- // > This is always at least 1, since every regex has at least one
- // > capture group that corresponds to the full match.
+ // > This is always at least 1, since every regex has at least one >
+ //capture group that corresponds to the full match.
//
// [docs]: https://docs.rs/regex/1.3.4/regex/struct.Captures.html#method.len
interp.set_active_regexp_globals(captures.len().checked_sub(1).unwrap_or_default())?;
@@ -307,8 +307,8 @@ impl RegexpType for Utf8 {
if let Some(captures) = self.regex.captures(haystack) {
// per the [docs] for `captures.len()`:
//
- // > This is always at least 1, since every regex has at least one
- // > capture group that corresponds to the full match.
+ // > This is always at least 1, since every regex has at least one >
+ //capture group that corresponds to the full match.
//
// [docs]: https://docs.rs/regex/1.3.4/regex/struct.Captures.html#method.len
interp.set_active_regexp_globals(captures.len().checked_sub(1).unwrap_or_default())?;
diff --git i/artichoke-backend/src/extn/core/regexp/syntax.rs w/artichoke-backend/src/extn/core/regexp/syntax.rs
index 5b82baa35c..4a1d410b70 100644
--- i/artichoke-backend/src/extn/core/regexp/syntax.rs
+++ w/artichoke-backend/src/extn/core/regexp/syntax.rs
@@ -1,9 +1,8 @@
// This module is forked from `regex-syntax` crate @ `26f7318e`.
//
-// https://github.com/rust-lang/regex/blob/26f7318e2895eae56e95a260e81e2d48b90e7c25/regex-syntax/src/lib.rs
+// //https://github.com/rust-lang/regex/blob/26f7318e2895eae56e95a260e81e2d48b90e7c25/regex-syntax/src/lib.rs
//
-// MIT License
-// Copyright (c) 2014 The Rust Project Developers
+// MIT License Copyright (c) 2014 The Rust Project Developers
#![allow(clippy::match_same_arms)]
@@ -52,8 +51,8 @@ pub fn escape_into(text: &str, buf: &mut String) {
pub fn is_meta_character(c: char) -> bool {
match c {
'\\' | '.' | '+' | '*' | '?' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '-' => true,
- // This match arm differs from `regex-syntax` by including '/'.
- // Ruby uses '/' to mark `Regexp` literals in source code.
+ // This match arm differs from `regex-syntax` by including '/'. Ruby uses
+ //'/' to mark `Regexp` literals in source code.
'/' => true,
// This match arm differs from `regex-syntax` by including ' ' (an ASCII
// space character). Ruby always escapes ' ' in calls to `Regexp::escape`.
diff --git i/artichoke-backend/src/extn/core/string/ffi.rs w/artichoke-backend/src/extn/core/string/ffi.rs
index 682719c0d2..6592b0f68c 100644
--- i/artichoke-backend/src/extn/core/string/ffi.rs
+++ w/artichoke-backend/src/extn/core/string/ffi.rs
@@ -184,7 +184,8 @@ unsafe extern "C" fn mrb_str_resize(mrb: *mut sys::mrb_state, s: sys::mrb_value,
match len.checked_sub(s.len()) {
Some(0) => {}
Some(additional) => s.try_reserve(additional)?,
- // If the given length is less than the length of the `String`, truncate.
+ // If the given length is less than the length of the `String`,
+ //truncate.
None => s.truncate(len),
}
Ok(())
@@ -220,9 +221,9 @@ unsafe extern "C" fn mrb_str_resize(mrb: *mut sys::mrb_state, s: sys::mrb_value,
// This is not possible on stable Rust since `TryReserveErrorKind` is
// unstable.
Err(_) => {
- // NOTE: This code can't use an `Error` unified exception trait object.
- // Since we're in memory error territory, we're not sure if we can
- // allocate the `Box` it requires.
+ // NOTE: This code can't use an `Error` unified exception trait
+ //object. Since we're in memory error territory, we're not sure if
+ //we can allocate the `Box` it requires.
let err = NoMemoryError::with_message("out of memory");
error::raise(guard, err);
}
@@ -496,7 +497,8 @@ unsafe extern "C" fn mrb_string_cstr(mrb: *mut sys::mrb_state, s: sys::mrb_value
// #define mrb_str_to_inum(mrb, str, base, badcheck) mrb_str_to_integer(mrb, str, base, badcheck)
// ```
//
-// This function converts a numeric string to numeric `mrb_value` with the given base.
+// This function converts a numeric string to numeric `mrb_value` with the given
+ //base.
#[no_mangle]
unsafe extern "C" fn mrb_str_to_integer(
mrb: *mut sys::mrb_state,
@@ -606,8 +608,8 @@ unsafe extern "C" fn mrb_str_cat(
if let Ok(mut string) = String::unbox_from_value(&mut s, &mut guard) {
let slice = slice::from_raw_parts(ptr.cast::<u8>(), len);
- // SAFETY: The string is repacked before any intervening uses of
- // `interp` which means no mruby heap allocations can occur.
+ // SAFETY: The string is repacked before any intervening uses of `interp`
+ //which means no mruby heap allocations can occur.
let string_mut = string.as_inner_mut();
string_mut.extend_from_slice(slice);
let inner = string.take();
diff --git i/artichoke-backend/src/extn/core/string/mod.rs w/artichoke-backend/src/extn/core/string/mod.rs
index d8f3ba100e..d42d324d5c 100644
--- i/artichoke-backend/src/extn/core/string/mod.rs
+++ w/artichoke-backend/src/extn/core/string/mod.rs
@@ -34,8 +34,8 @@ impl BoxUnboxVmValue for String {
) -> Result<UnboxedValueGuard<'a, Self::Guarded>, Error> {
let _ = interp;
- // Make sure we have a String otherwise extraction will fail.
- // This check is critical to the safety of accessing the `value` union.
+ // Make sure we have a String otherwise extraction will fail. This check
+ //is critical to the safety of accessing the `value` union.
if value.ruby_type() != Ruby::String {
let mut message = std::string::String::from("uninitialized ");
message.push_str(Self::RUBY_TYPE);
@@ -129,9 +129,9 @@ impl BoxUnboxVmValue for String {
}
fn free(data: *mut c_void) {
- // this function is never called. `String` is freed directly in the VM
- // by calling `mrb_gc_free_str` which is defined in
- // `extn/core/string/ffi.rs`.
+ // this function is never called. `String` is freed directly in the VM by
+ //calling `mrb_gc_free_str` which is defined in
+ //`extn/core/string/ffi.rs`.
//
// `String` should not have a destructor registered in the class
// registry.
@@ -168,8 +168,8 @@ mod tests {
#[test]
fn modifying_and_repacking_encoding_zeroes_old_encoding_flags() {
let mut interp = interpreter();
- // Modify the encoding of a binary string in place to be UTF-8 by
- // pushing a UTF-8 string into an empty binary string.
+ // Modify the encoding of a binary string in place to be UTF-8 by pushing
+ //a UTF-8 string into an empty binary string.
//
// Test for the newly taken UTF-8 encoding by ensuring that the char
// length of the string is 1.
diff --git i/artichoke-backend/src/extn/core/string/mruby.rs w/artichoke-backend/src/extn/core/string/mruby.rs
index 51d9a1593a..ab24142d8e 100644
--- i/artichoke-backend/src/extn/core/string/mruby.rs
+++ w/artichoke-backend/src/extn/core/string/mruby.rs
@@ -22,7 +22,11 @@ pub fn init(interp: &mut Artichoke) -> InitializeResult<()> {
.add_method("[]=", string_aset, sys::mrb_args_any())?
.add_method("ascii_only?", string_ascii_only, sys::mrb_args_none())?
.add_method("b", string_b, sys::mrb_args_none())?
- .add_method("bytes", string_bytes, sys::mrb_args_none())? // This does not support the deprecated block form
+ .add_method("bytes", string_bytes, sys::mrb_args_none())? // This does
+ //not support
+ //the
+ //deprecated
+ //block form
.add_method("bytesize", string_bytesize, sys::mrb_args_none())?
.add_method("byteslice", string_byteslice, sys::mrb_args_req_and_opt(1, 1))?
.add_method("capitalize", string_capitalize, sys::mrb_args_any())?
@@ -30,14 +34,25 @@ pub fn init(interp: &mut Artichoke) -> InitializeResult<()> {
.add_method("casecmp", string_casecmp_ascii, sys::mrb_args_req(1))?
.add_method("casecmp?", string_casecmp_unicode, sys::mrb_args_req(1))?
.add_method("center", string_center, sys::mrb_args_req_and_opt(1, 1))?
- .add_method("chars", string_chars, sys::mrb_args_none())? // This does not support the deprecated block form
+ .add_method("chars", string_chars, sys::mrb_args_none())? // This does
+ //not support
+ //the
+ //deprecated
+ //block form
.add_method("chomp", string_chomp, sys::mrb_args_opt(1))?
.add_method("chomp!", string_chomp_bang, sys::mrb_args_opt(1))?
.add_method("chop", string_chop, sys::mrb_args_none())?
.add_method("chop!", string_chop_bang, sys::mrb_args_none())?
.add_method("chr", string_chr, sys::mrb_args_none())?
.add_method("clear", string_clear, sys::mrb_args_none())?
- .add_method("codepoints", string_codepoints, sys::mrb_args_none())? // This does not support the deprecated block form
+ .add_method("codepoints", string_codepoints, sys::mrb_args_none())? // //This
+ //does
+ //not
+ //support
+ //the
+ //deprecated
+ //block
+ //form
.add_method("concat", string_concat, sys::mrb_args_any())?
.add_method("downcase", string_downcase, sys::mrb_args_any())?
.add_method("downcase!", string_downcase_bang, sys::mrb_args_any())?
@@ -47,7 +62,12 @@ pub fn init(interp: &mut Artichoke) -> InitializeResult<()> {
.add_method("hash", string_hash, sys::mrb_args_none())?
.add_method("include?", string_include, sys::mrb_args_req(1))?
.add_method("index", string_index, sys::mrb_args_req_and_opt(1, 1))?
- .add_method("initialize", string_initialize, sys::mrb_args_opt(1))? // TODO: support encoding and capacity kwargs
+ .add_method("initialize", string_initialize, sys::mrb_args_opt(1))? // //TODO:
+ //support
+ //encoding
+ //and
+ //capacity
+ //kwargs
.add_method("initialize_copy", string_initialize_copy, sys::mrb_args_req(1))?
.add_method("inspect", string_inspect, sys::mrb_args_none())?
.add_method("intern", string_intern, sys::mrb_args_none())?
diff --git i/artichoke-backend/src/extn/core/string/trampoline.rs w/artichoke-backend/src/extn/core/string/trampoline.rs
index 68b9441beb..432403ddff 100644
--- i/artichoke-backend/src/extn/core/string/trampoline.rs
+++ w/artichoke-backend/src/extn/core/string/trampoline.rs
@@ -41,8 +41,8 @@ pub fn add(interp: &mut Artichoke, mut value: Value, mut other: Value) -> Result
let to_append = unsafe { implicitly_convert_to_string(interp, &mut other)? };
let mut concatenated = s.clone();
- // XXX: This call doesn't do a check to see if we'll exceed the max allocation
- // size and may panic or abort.
+ // XXX: This call doesn't do a check to see if we'll exceed the max
+ //allocation size and may panic or abort.
concatenated.extend_from_slice(to_append);
super::String::alloc_value(concatenated, interp)
}
@@ -59,12 +59,12 @@ pub fn append(interp: &mut Artichoke, mut value: Value, mut other: Value) -> Res
let mut s = unsafe { super::String::unbox_from_value(&mut value, interp)? };
if let Ok(int) = other.try_convert_into::<i64>(interp) {
- // SAFETY: The string is repacked before any intervening uses of
- // `interp` which means no mruby heap allocations can occur.
+ // SAFETY: The string is repacked before any intervening uses of `interp`
+ //which means no mruby heap allocations can occur.
unsafe {
let string_mut = s.as_inner_mut();
- // XXX: This call doesn't do a check to see if we'll exceed the max allocation
- // size and may panic or abort.
+ // XXX: This call doesn't do a check to see if we'll exceed the max
+ //allocation size and may panic or abort.
string_mut
.try_push_int(int)
.map_err(|err| RangeError::from(err.message()))?;
@@ -129,12 +129,13 @@ pub fn append(interp: &mut Artichoke, mut value: Value, mut other: Value) -> Res
// `interp` which means no mruby heap allocations can occur.
unsafe {
let string_mut = s.as_inner_mut();
- // XXX: This call doesn't do a check to see if we'll exceed the max allocation
- // size and may panic or abort.
+ // XXX: This call doesn't do a check to see if we'll exceed the
+ //max allocation size and may panic or abort.
string_mut.extend_from_slice(other.as_slice());
if !matches!(other.encoding(), Encoding::Utf8) && !other.is_ascii_only() {
- // encodings are incompatible if other is not UTF-8 and is non-ASCII
+ // encodings are incompatible if other is not UTF-8 and is
+ //non-ASCII
string_mut.set_encoding(other.encoding());
}
@@ -177,8 +178,8 @@ pub fn append(interp: &mut Artichoke, mut value: Value, mut other: Value) -> Res
// `interp` which means no mruby heap allocations can occur.
unsafe {
let string_mut = s.as_inner_mut();
- // XXX: This call doesn't do a check to see if we'll exceed the max allocation
- // size and may panic or abort.
+ // XXX: This call doesn't do a check to see if we'll exceed the
+ //max allocation size and may panic or abort.
string_mut.extend_from_slice(other.as_slice());
// Set encoding to `other.encoding()` if other is non-ASCII.
@@ -229,8 +230,8 @@ pub fn append(interp: &mut Artichoke, mut value: Value, mut other: Value) -> Res
// `interp` which means no mruby heap allocations can occur.
unsafe {
let string_mut = s.as_inner_mut();
- // XXX: This call doesn't do a check to see if we'll exceed the max allocation
- // size and may panic or abort.
+ // XXX: This call doesn't do a check to see if we'll exceed the
+ //max allocation size and may panic or abort.
string_mut.extend_from_slice(other.as_slice());
let s = s.take();
@@ -274,8 +275,8 @@ pub fn append(interp: &mut Artichoke, mut value: Value, mut other: Value) -> Res
// `interp` which means no mruby heap allocations can occur.
unsafe {
let string_mut = s.as_inner_mut();
- // XXX: This call doesn't do a check to see if we'll exceed the max allocation
- // size and may panic or abort.
+ // XXX: This call doesn't do a check to see if we'll exceed the
+ //max allocation size and may panic or abort.
string_mut.extend_from_slice(other.as_slice());
if !other.is_ascii_only() {
@@ -291,8 +292,8 @@ pub fn append(interp: &mut Artichoke, mut value: Value, mut other: Value) -> Res
// `interp` which means no mruby heap allocations can occur.
unsafe {
let string_mut = s.as_inner_mut();
- // XXX: This call doesn't do a check to see if we'll exceed the max allocation
- // size and may panic or abort.
+ // XXX: This call doesn't do a check to see if we'll exceed the
+ //max allocation size and may panic or abort.
string_mut.extend_from_slice(other.as_slice());
let s = s.take();
@@ -365,10 +366,10 @@ pub fn aref(
// => nil
// ```
//
- // Don't specialize on the case where `index == len` because the provided
- // length can change the result. Even if the length argument is not
- // given, we still need to preserve the encoding of the source string,
- // so fall through to the happy path below.
+ // Don't specialize on the case where `index == len` because the
+ //provided length can change the result. Even if the length argument
+ //is not given, we still need to preserve the encoding of the source
+ //string, so fall through to the happy path below.
Some(index) if index > s.len() => return Ok(Value::nil()),
Some(index) => index,
};
@@ -468,8 +469,8 @@ pub fn aref(
return Ok(Value::nil());
}
}
- // The overload of `String#[]` that takes a `String` **only** takes `String`s.
- // No implicit conversion is performed.
+ // The overload of `String#[]` that takes a `String` **only** takes
+ //`String`s. No implicit conversion is performed.
//
// ```
// [3.0.1] > s = "abc"
@@ -487,9 +488,9 @@ pub fn aref(
// ```
if let Ok(substring) = unsafe { super::String::unbox_from_value(&mut first, interp) } {
if s.index(&*substring, None).is_some() {
- // Indexing with a `String` returns a newly allocated object that
- // has the same encoding as the index, regardless of the encoding on
- // the receiver.
+ // Indexing with a `String` returns a newly allocated object that has
+ //the same encoding as the index, regardless of the encoding on the
+ //receiver.
//
// ```
// [3.0.2] > s = "abc"
@@ -702,12 +703,14 @@ pub fn byteslice(
let length = if let Some(length) = length {
length
} else {
- // Per the docs -- https://ruby-doc.org/core-3.1.2/String.html#method-i-byteslice
+ // Per the docs --
+ //https://ruby-doc.org/core-3.1.2/String.html#method-i-byteslice
//
- // > If passed a single Integer, returns a substring of one byte at that position.
+ // > If passed a single Integer, returns a substring of one byte at that
+ //position.
//
- // NOTE: Index out a single byte rather than a slice to avoid having
- // to do an overflow check on the addition.
+ // NOTE: Index out a single byte rather than a slice to avoid having to
+ //do an overflow check on the addition.
if let Some(&byte) = s.get(index) {
let s = super::String::with_bytes_and_encoding(vec![byte], s.encoding());
// ```
@@ -862,7 +865,8 @@ pub fn casecmp_ascii(interp: &mut Artichoke, mut value: Value, mut other: Value)
pub fn casecmp_unicode(interp: &mut Artichoke, mut value: Value, mut other: Value) -> Result<Value, Error> {
let s = unsafe { super::String::unbox_from_value(&mut value, interp)? };
- // TODO: this needs to do an implicit conversion, but we need a Spinoso string.
+ // TODO: this needs to do an implicit conversion, but we need a Spinoso
+ //string.
if let Ok(other) = unsafe { super::String::unbox_from_value(&mut other, interp) } {
let eql = *s == *other;
Ok(interp.convert(eql))
@@ -1045,8 +1049,8 @@ pub fn downcase_bang(interp: &mut Artichoke, mut value: Value) -> Result<Value,
// which means no mruby heap allocations can occur.
unsafe {
let string_mut = s.as_inner_mut();
- // `make_lowercase` might reallocate the string and invalidate the
- // boxed pointer, capacity, length triple.
+ // `make_lowercase` might reallocate the string and invalidate the boxed
+ //pointer, capacity, length triple.
string_mut.make_lowercase();
let s = s.take();
@@ -1150,8 +1154,8 @@ pub fn initialize(interp: &mut Artichoke, mut value: Value, from: Option<Value>)
Vec::new()
};
- // If we are calling `initialize` on an already initialized `String`,
- // pluck out the inner buffer and drop it so we don't leak memory.
+ // If we are calling `initialize` on an already initialized `String`, pluck
+ //out the inner buffer and drop it so we don't leak memory.
//
// ```console
// [3.0.2] > s = "abc"
@@ -1411,8 +1415,8 @@ pub fn setbyte(interp: &mut Artichoke, mut value: Value, index: Value, byte: Val
index
} else {
let mut message = String::from("index ");
- // Suppress error because `String`'s `fmt::Write` impl is infallible.
- // (It will abort on OOM).
+ // Suppress error because `String`'s `fmt::Write` impl is infallible. (It
+ //will abort on OOM).
let _ignored = write!(&mut message, "{} out of string", index);
return Err(IndexError::from(message).into());
};
@@ -1550,8 +1554,8 @@ pub fn upcase_bang(interp: &mut Artichoke, mut value: Value) -> Result<Value, Er
// which means no mruby heap allocations can occur.
unsafe {
let string_mut = s.as_inner_mut();
- // `make_uppercase` might reallocate the string and invalidate the
- // boxed pointer, capacity, length triple.
+ // `make_uppercase` might reallocate the string and invalidate the boxed
+ //pointer, capacity, length triple.
string_mut.make_uppercase();
let s = s.take();
diff --git i/artichoke-backend/src/extn/core/symbol/ffi.rs w/artichoke-backend/src/extn/core/symbol/ffi.rs
index 5469950682..b4bb7f18d2 100644
--- i/artichoke-backend/src/extn/core/symbol/ffi.rs
+++ w/artichoke-backend/src/extn/core/symbol/ffi.rs
@@ -60,7 +60,7 @@ unsafe extern "C" fn mrb_intern_str(mrb: *mut sys::mrb_state, name: sys::mrb_val
}
}
-/* `mrb_intern_check` series functions returns 0 if the symbol is not defined */
+/* `mrb_intern_check` series functions returns 0 if the symbol is not defined*/
// ```c
// MRB_API mrb_sym mrb_intern_check(mrb_state*,const char*,size_t);
@@ -207,8 +207,8 @@ unsafe extern "C" fn mrb_sym_dump(mrb: *mut sys::mrb_state, sym: sys::mrb_sym) -
unwrap_interpreter!(mrb, to => guard, or_else = ptr::null());
if let Ok(Some(bytes)) = guard.lookup_symbol(sym) {
let bytes = bytes.to_vec();
- // Allocate a buffer with the lifetime of the interpreter and return
- // a pointer to it.
+ // Allocate a buffer with the lifetime of the interpreter and return a
+ //pointer to it.
if let Ok(string) = guard.try_convert_mut(bytes) {
if let Ok(bytes) = string.try_convert_into_mut::<&[u8]>(&mut guard) {
return bytes.as_ptr().cast();
diff --git i/artichoke-backend/src/extn/core/symbol/mod.rs w/artichoke-backend/src/extn/core/symbol/mod.rs
index 3194eeefa0..474b5c79ed 100644
--- i/artichoke-backend/src/extn/core/symbol/mod.rs
+++ w/artichoke-backend/src/extn/core/symbol/mod.rs
@@ -22,8 +22,8 @@ impl BoxUnboxVmValue for Symbol {
) -> Result<UnboxedValueGuard<'a, Self::Guarded>, Error> {
let _ = interp;
- // Make sure we have a Symbol otherwise extraction will fail.
- // This check is critical to the safety of accessing the `value` union.
+ // Make sure we have a Symbol otherwise extraction will fail. This check
+ //is critical to the safety of accessing the `value` union.
if value.ruby_type() != Ruby::Symbol {
let mut message = String::from("uninitialized ");
message.push_str(Self::RUBY_TYPE);
diff --git i/artichoke-backend/src/extn/core/time/mruby.rs w/artichoke-backend/src/extn/core/time/mruby.rs
index 4aa4e7e816..2fcf476ece 100644
--- i/artichoke-backend/src/extn/core/time/mruby.rs
+++ w/artichoke-backend/src/extn/core/time/mruby.rs
@@ -13,8 +13,8 @@ pub fn init(interp: &mut Artichoke) -> InitializeResult<()> {
}
let spec = class::Spec::new("Time", TIME_CSTR, None, Some(def::box_unbox_free::<time::Time>))?;
- // NOTE: The ordering of method declarations in the builder below is the
- // same as in `Init_Time` in MRI `time.c`.
+ // NOTE: The ordering of method declarations in the builder below is the same
+ //as in `Init_Time` in MRI `time.c`.
class::Builder::for_spec(interp, &spec)
.value_is_rust_object()
// Constructor
diff --git i/artichoke-backend/src/extn/core/time/offset.rs w/artichoke-backend/src/extn/core/time/offset.rs
index a7cd0c21a4..29695b76de 100644
--- i/artichoke-backend/src/extn/core/time/offset.rs
+++ w/artichoke-backend/src/extn/core/time/offset.rs
@@ -52,8 +52,8 @@ impl TryConvertMut<Value, Option<Offset>> for Artichoke {
}
}
- // Based on the above logic, the only option in the hash is `in`.
- // >0 keys, and all other keys are rejected).
+ // Based on the above logic, the only option in the hash is `in`. >0
+ //keys, and all other keys are rejected).
let mut in_value = hash.get(0).expect("Only the `in` parameter should be available").1;
match in_value.ruby_type() {
diff --git i/artichoke-backend/src/extn/core/time/subsec.rs w/artichoke-backend/src/extn/core/time/subsec.rs
index d86f332c46..2bf49f7cfd 100644
--- i/artichoke-backend/src/extn/core/time/subsec.rs
+++ w/artichoke-backend/src/extn/core/time/subsec.rs
@@ -62,10 +62,10 @@ impl TryConvertMut<Option<Value>, SubsecMultiplier> for Artichoke {
}
}
-/// A struct that represents the adjustment needed to a `Time` based on a
-/// the parsing of optional Ruby Values. Seconds can require adjustment as a
-/// means for handling overflow of values. e.g. `1_001` millis can be requested
-/// which should result in 1 seconds, and `1_000_000` nanoseconds.
+/// A struct that represents the adjustment needed to a `Time` based on a the
+/// parsing of optional Ruby Values. Seconds can require adjustment as a means
+/// for handling overflow of values. e.g. `1_001` millis can be requested which
+/// should result in 1 seconds, and `1_000_000` nanoseconds.
///
/// Note: Negative nanoseconds are not supported, thus any negative adjustment
/// will generally result in at least -1 second, and the relevant positive
@@ -103,9 +103,9 @@ impl TryConvertMut<(Option<Value>, Option<Value>), Subsec> for Artichoke {
let seconds_base = NANOS_IN_SECOND / multiplier_nanos;
if subsec.ruby_type() == Ruby::Float {
- // FIXME: The below deviates from the MRI implementation of
- // Time. MRI uses `to_r` for subsec calculation on floats
- // subsec nanos, and this could result in different values.
+ // FIXME: The below deviates from the MRI implementation of Time.
+ //MRI uses `to_r` for subsec calculation on floats subsec nanos,
+ //and this could result in different values.
let subsec: f64 = self.try_convert(subsec)?;
@@ -119,9 +119,9 @@ impl TryConvertMut<(Option<Value>, Option<Value>), Subsec> for Artichoke {
return Err(FloatDomainError::with_message("Infinity").into());
}
- // These conversions are luckily not lossy. `seconds_base`
- // and `multiplier_nanos` are guaranteed to be represented
- // without loss in a f64.
+ // These conversions are luckily not lossy. `seconds_base` and
+ //`multiplier_nanos` are guaranteed to be represented without
+ //loss in a f64.
#[allow(clippy::cast_precision_loss)]
let seconds_base = seconds_base as f64;
#[allow(clippy::cast_precision_loss)]
@@ -133,10 +133,10 @@ impl TryConvertMut<(Option<Value>, Option<Value>), Subsec> for Artichoke {
// `is_sign_negative()` is not enough here, since this logic
// should also be skilled for negative zero.
if subsec < -0.0 {
- // Nanos always needs to be a positive u32. If subsec
- // is negative, we will always need remove one second.
- // Nanos can then be adjusted since it will always be
- // the inverse of the total nanos in a second.
+ // Nanos always needs to be a positive u32. If subsec is
+ //negative, we will always need remove one second. Nanos can
+ //then be adjusted since it will always be the inverse of
+ //the total nanos in a second.
secs -= 1.0;
#[allow(clippy::cast_precision_loss)]
@@ -159,18 +159,17 @@ impl TryConvertMut<(Option<Value>, Option<Value>), Subsec> for Artichoke {
} else {
let subsec: i64 = implicitly_convert_to_int(self, subsec)?;
- // The below calculations should always be safe. The
- // multiplier is guaranteed to not be 0, the remainder
- // should never overflow, and is guaranteed to be less
- // than u32::MAX.
+ // The below calculations should always be safe. The multiplier
+ //is guaranteed to not be 0, the remainder should never
+ //overflow, and is guaranteed to be less than u32::MAX.
let mut secs = subsec / seconds_base;
let mut nanos = (subsec % seconds_base) * multiplier_nanos;
if subsec.is_negative() {
- // Nanos always needs to be a positive u32. If subsec
- // is negative, we will always need remove one second.
- // Nanos can then be adjusted since it will always be
- // the inverse of the total nanos in a second.
+ // Nanos always needs to be a positive u32. If subsec is
+ //negative, we will always need remove one second. Nanos can
+ //then be adjusted since it will always be the inverse of
+ //the total nanos in a second.
secs = secs
.checked_sub(1)
.ok_or(ArgumentError::with_message("Time too small"))?;
diff --git i/artichoke-backend/src/extn/mod.rs w/artichoke-backend/src/extn/mod.rs
index 79ccd7979e..7fbaf5bc1d 100644
--- i/artichoke-backend/src/extn/mod.rs
+++ w/artichoke-backend/src/extn/mod.rs
@@ -1,5 +1,5 @@
-// This pragma is needed to allow passing `Value` by value in all the mruby
-// and Rust trampolines.
+// This pragma is needed to allow passing `Value` by value in all the mruby and
+ //Rust trampolines.
#![allow(clippy::needless_pass_by_value)]
use crate::release_metadata::ReleaseMetadata;
diff --git i/artichoke-backend/src/extn/prelude.rs w/artichoke-backend/src/extn/prelude.rs
index e80f1e5cb6..099e160b61 100644
--- i/artichoke-backend/src/extn/prelude.rs
+++ w/artichoke-backend/src/extn/prelude.rs
@@ -1,5 +1,4 @@
-//! A "prelude" for users of the `extn` module in the `artichoke-backend`
-//! crate.
+//! A "prelude" for users of the `extn` module in the `artichoke-backend` crate.
//!
//! This prelude is similar to the standard library's prelude in that you'll
//! almost always want to import its entire contents, but unlike the standard
diff --git i/artichoke-backend/src/extn/stdlib/json/mod.rs w/artichoke-backend/src/extn/stdlib/json/mod.rs
index e6a4fd0cbc..849051d129 100644
--- i/artichoke-backend/src/extn/stdlib/json/mod.rs
+++ w/artichoke-backend/src/extn/stdlib/json/mod.rs
@@ -14,9 +14,9 @@ static JSON_PURE_PARSER_RUBY_SOURCE: &[u8] = include_bytes!("vendor/json/pure/pa
pub fn init(interp: &mut Artichoke) -> InitializeResult<()> {
let spec = module::Spec::new(interp, "JSON", JSON_CSTR, None)?;
interp.def_module::<Json>(spec)?;
- // NOTE(lopopolo): This setup of the JSON gem in the virtual file system does not include
- // any of the `json/add` sources for serializing "extra" types like `Time`
- // and `BigDecimal`, not all of which Artichoke supports.
+ // NOTE(lopopolo): This setup of the JSON gem in the virtual file system does
+ //not include any of the `json/add` sources for serializing "extra" types
+ //like `Time` and `BigDecimal`, not all of which Artichoke supports.
interp.def_rb_source_file("json.rb", JSON_RUBY_SOURCE)?;
interp.def_rb_source_file("json/common.rb", JSON_COMMON_RUBY_SOURCE)?;
interp.def_rb_source_file("json/generic_object.rb", JSON_GENERIC_OBJECT_RUBY_SOURCE)?;
diff --git i/artichoke-backend/src/fmt.rs w/artichoke-backend/src/fmt.rs
index d18c01ba02..ed2343cda2 100644
--- i/artichoke-backend/src/fmt.rs
+++ w/artichoke-backend/src/fmt.rs
@@ -16,7 +16,7 @@ use crate::Artichoke;
/// This error type can also be used to convert generic [`fmt::Error`] into an
/// [`Error`], such as when formatting integers with [`write!`].
///
-/// This error type wraps a [`fmt::Error`].
+/// This error type wraps a [`fmt::Error`].
///
/// # Examples
///
diff --git i/artichoke-backend/src/gc.rs w/artichoke-backend/src/gc.rs
index 985f9e46aa..e0c1ca83ca 100644
--- i/artichoke-backend/src/gc.rs
+++ w/artichoke-backend/src/gc.rs
@@ -10,8 +10,8 @@ use arena::{ArenaIndex, ArenaSavepointError};
pub trait MrbGarbageCollection {
/// Create a savepoint in the GC arena.
///
- /// Savepoints allow mruby to deallocate all the objects created via the
- /// C API.
+ /// Savepoints allow mruby to deallocate all the objects created via the C
+ /// API.
///
/// Normally objects created via the C API are marked as permanently alive
/// ("white" GC color) with a call to [`mrb_gc_protect`].
@@ -251,8 +251,8 @@ mod tests {
interp.full_gc().unwrap();
assert_eq!(
interp.live_object_count(),
- // plus 1 because stack keep is enabled in eval which marks the
- // last returned value as live.
+ // plus 1 because stack keep is enabled in eval which marks the last
+ //returned value as live.
baseline_object_count + 1,
"Started with {} live objects, ended with {}. Potential memory leak!",
baseline_object_count,
diff --git i/artichoke-backend/src/gc/arena.rs w/artichoke-backend/src/gc/arena.rs
index 4b187c0292..46932b333a 100644
--- i/artichoke-backend/src/gc/arena.rs
+++ w/artichoke-backend/src/gc/arena.rs
@@ -70,9 +70,9 @@ impl From<ArenaSavepointError> for Error {
/// Arena savepoints ensure mruby objects are reaped even when allocated with
/// the C API.
///
-/// mruby manages objects created via the C API in a memory construct called
-/// the [arena]. The arena is a stack and objects stored there are permanently
-/// alive to avoid having to track lifetimes externally to the interpreter.
+/// mruby manages objects created via the C API in a memory construct called the
+/// [arena]. The arena is a stack and objects stored there are permanently alive
+/// to avoid having to track lifetimes externally to the interpreter.
///
/// An [`ArenaIndex`] is an index to some position of the stack. When restoring
/// an `ArenaIndex`, the stack pointer is moved. All objects beyond the pointer
@@ -134,8 +134,8 @@ impl<'a> DerefMut for ArenaIndex<'a> {
impl<'a> Drop for ArenaIndex<'a> {
fn drop(&mut self) {
let idx = self.index;
- // We can't panic in a drop impl, so ignore errors when crossing the
- // FFI boundary.
+ // We can't panic in a drop impl, so ignore errors when crossing the FFI
+ //boundary.
let _ignored = unsafe {
self.interp
.with_ffi_boundary(|mrb| sys::mrb_sys_gc_arena_restore(mrb, idx))
diff --git i/artichoke-backend/src/globals.rs w/artichoke-backend/src/globals.rs
index 08de0382ee..21c91b31c7 100644
--- i/artichoke-backend/src/globals.rs
+++ w/artichoke-backend/src/globals.rs
@@ -6,8 +6,8 @@ use crate::sys;
use crate::value::Value;
use crate::Artichoke;
-// TODO: Handle invalid variable names. For now this is delegated to mruby.
-// The parser in `spinoso-symbol` can handle this.
+// TODO: Handle invalid variable names. For now this is delegated to mruby. The
+ //parser in `spinoso-symbol` can handle this.
impl Globals for Artichoke {
type Value = Value;
diff --git i/artichoke-backend/src/interpreter.rs w/artichoke-backend/src/interpreter.rs
index 7e5708bfb0..05fa7c5a08 100644
--- i/artichoke-backend/src/interpreter.rs
+++ w/artichoke-backend/src/interpreter.rs
@@ -63,9 +63,9 @@ pub fn interpreter_with_config(config: ReleaseMetadata<'_>) -> Result<Artichoke,
}
arena.restore();
- // mruby lazily initializes some core objects like `top_self` and generates
- // a lot of garbage on start-up. Eagerly initialize the interpreter to
- // provide predictable initialization behavior.
+ // mruby lazily initializes some core objects like `top_self` and generates a
+ //lot of garbage on start-up. Eagerly initialize the interpreter to provide
+ //predictable initialization behavior.
interp.create_arena_savepoint()?.interp().eval(&[])?;
if let GcState::Enabled = prior_gc_state {
diff --git i/artichoke-backend/src/lib.rs w/artichoke-backend/src/lib.rs
index 7d861dea63..7a64e5fa48 100644
--- i/artichoke-backend/src/lib.rs
+++ w/artichoke-backend/src/lib.rs
@@ -2,8 +2,8 @@
#![warn(clippy::pedantic)]
#![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
+#![allow(clippy::question_mark)] // //https://github.com/rust-lang/rust-clippy/issues/8281
+ //https://github.com/rust-lang/rust-clippy/issues/8109
#![cfg_attr(test, allow(clippy::non_ascii_literal))]
#![allow(unknown_lints)]
// #![warn(missing_docs)]
@@ -28,8 +28,8 @@
//!
//! ### Evaling Source Code
//!
-//! The `artichoke-backend` interpreter implements
-//! [`Eval` from `artichoke-core`](crate::core::Eval).
+//! The `artichoke-backend` interpreter implements [`Eval` from
+//! `artichoke-core`](crate::core::Eval).
//!
//! ```rust
//! use artichoke_backend::prelude::*;
@@ -68,8 +68,8 @@
//!
//! ## Virtual File System and `Kernel#require`
//!
-//! The `artichoke-backend` interpreter includes an in-memory virtual
-//! file system. The file system stores Ruby sources and Rust extension functions
+//! The `artichoke-backend` interpreter includes an in-memory virtual file
+//! system. The file system stores Ruby sources and Rust extension functions
//! that are similar to MRI C extensions.
//!
//! The virtual file system enables applications built with `artichoke-backend`
diff --git i/artichoke-backend/src/load_path.rs w/artichoke-backend/src/load_path.rs
index 895c86c2c8..c3ec1ed071 100644
--- i/artichoke-backend/src/load_path.rs
+++ w/artichoke-backend/src/load_path.rs
@@ -32,8 +32,8 @@ pub use native::Native;
/// Directory at which Ruby sources and extensions are stored in the virtual
/// file system.
///
-/// `RUBY_LOAD_PATH` is the default current working directory for
-/// [`Memory`] file systems.
+/// `RUBY_LOAD_PATH` is the default current working directory for [`Memory`]
+/// file systems.
///
/// [`Hybrid`] file systems locate the path on a [`Memory`] file system.
#[cfg(not(windows))]
@@ -42,8 +42,8 @@ pub const RUBY_LOAD_PATH: &str = "/artichoke/virtual_root/src/lib";
/// Directory at which Ruby sources and extensions are stored in the virtual
/// file system.
///
-/// `RUBY_LOAD_PATH` is the default current working directory for
-/// [`Memory`] file systems.
+/// `RUBY_LOAD_PATH` is the default current working directory for [`Memory`]
+/// file systems.
///
/// [`Hybrid`] file systems locate the path on a [`Memory`] file system.
#[cfg(windows)]
diff --git i/artichoke-backend/src/macros.rs w/artichoke-backend/src/macros.rs
index d888165fae..c55affb3ef 100644
--- i/artichoke-backend/src/macros.rs
+++ w/artichoke-backend/src/macros.rs
@@ -19,8 +19,8 @@ macro_rules! emit_fatal_warning {
// called when there are foreign C frames in the stack and panics are
// either undefined behavior or will result in an abort.
//
- // Ensure the returned error is dropped so we don't leave anything on
- // the stack in the event of a foreign unwind.
+ // Ensure the returned error is dropped so we don't leave anything on the
+ //stack in the event of a foreign unwind.
let maybe_err = ::std::write!(::std::io::stderr(), "fatal[artichoke-backend]: ");
drop(maybe_err);
let maybe_err = ::std::writeln!(::std::io::stderr(), $($arg)+);
@@ -96,8 +96,8 @@ pub mod argspec {
pub const REST: &CStr = qed::const_cstr_from_str!("*\0");
}
-/// Extract [`sys::mrb_value`]s from a [`sys::mrb_state`] to adapt a C
-/// entry point to a Rust implementation of a Ruby function.
+/// Extract [`sys::mrb_value`]s from a [`sys::mrb_state`] to adapt a C entry
+/// point to a Rust implementation of a Ruby function.
///
/// This macro exists because the mruby VM [does not validate argspecs] attached
/// to native functions.
diff --git i/artichoke-backend/src/module.rs w/artichoke-backend/src/module.rs
index 7958fa7ba6..f9869de06a 100644
--- i/artichoke-backend/src/module.rs
+++ w/artichoke-backend/src/module.rs
@@ -137,13 +137,13 @@ impl Rclass {
let is_defined_under =
sys::mrb_const_defined_at(mrb, sys::mrb_sys_obj_value(scope.cast::<c_void>().as_mut()), self.sym);
if is_defined_under {
- // Enclosing scope exists.
- // Module is defined under the enclosing scope.
+ // Enclosing scope exists. Module is defined under the enclosing
+ //scope.
let module = sys::mrb_module_get_under(mrb, scope.as_mut(), module_name);
NonNull::new(module)
} else {
- // Enclosing scope exists.
- // Module is not defined under the enclosing scope.
+ // Enclosing scope exists. Module is not defined under the
+ //enclosing scope.
None
}
} else {
diff --git i/artichoke-backend/src/module/registry.rs w/artichoke-backend/src/module/registry.rs
index 06587e7b0a..ac76beff82 100644
--- i/artichoke-backend/src/module/registry.rs
+++ w/artichoke-backend/src/module/registry.rs
@@ -233,9 +233,8 @@ where
self.0.shrink_to_fit();
}
- /// Shrinks the capacity of the registry with a lower bound.
- /// The capacity will remain at least as large as both the length and the
- /// supplied value.
+ /// Shrinks the capacity of the registry with a lower bound. The capacity
+ /// will remain at least as large as both the length and the supplied value.
///
/// If the current capacity is less than the lower limit, this is a no-op.
pub fn shrink_to(&mut self, min_capacity: usize) {
diff --git i/artichoke-backend/src/sys/args.rs w/artichoke-backend/src/sys/args.rs
index 0e80b577e4..a17bfc27da 100644
--- i/artichoke-backend/src/sys/args.rs
+++ w/artichoke-backend/src/sys/args.rs
@@ -259,7 +259,7 @@ pub mod specifiers {
/// The following args specified are optional.
pub const FOLLOWING_ARGS_OPTIONAL: &str = "|";
- /// Retrieve a Boolean indicating whether the previous optional argument
- /// was given.
+ /// Retrieve a Boolean indicating whether the previous optional argument was
+ /// given.
pub const PREVIOUS_OPTIONAL_ARG_GIVEN: &str = "?";
}
diff --git i/artichoke-backend/src/sys/mod.rs w/artichoke-backend/src/sys/mod.rs
index ed374e56ed..50234d7ae7 100644
--- i/artichoke-backend/src/sys/mod.rs
+++ w/artichoke-backend/src/sys/mod.rs
@@ -22,7 +22,8 @@ mod args;
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::restriction)]
-#[cfg_attr(test, allow(deref_nullptr))] // See https://github.com/rust-lang/rust-bindgen/issues/1651.
+#[cfg_attr(test, allow(deref_nullptr))] // See
+ //https://github.com/rust-lang/rust-bindgen/issues/1651.
mod ffi {
include!(concat!(env!("OUT_DIR"), "/ffi.rs"));
}
diff --git i/artichoke-backend/src/sys/protect.rs w/artichoke-backend/src/sys/protect.rs
index 25782f4c1b..262970f6cf 100644
--- i/artichoke-backend/src/sys/protect.rs
+++ w/artichoke-backend/src/sys/protect.rs
@@ -58,8 +58,8 @@ trait Protect {
unsafe extern "C" fn run(mrb: *mut sys::mrb_state, data: sys::mrb_value) -> sys::mrb_value;
}
-// `Funcall` must be `Copy` because we may unwind past the frames in which
-// it is used with `longjmp` which does not allow Rust to run destructors.
+// `Funcall` must be `Copy` because we may unwind past the frames in which it is
+ //used with `longjmp` which does not allow Rust to run destructors.
#[derive(Clone, Copy)]
struct Funcall<'a> {
slf: sys::mrb_value,
@@ -76,9 +76,9 @@ impl<'a> Protect for Funcall<'a> {
// allow Rust to run destructors.
let Self { slf, func, args, block } = *Box::from_raw(ptr.cast::<Self>());
- // This will always unwrap because we've already checked that we
- // have fewer than `MRB_FUNCALL_ARGC_MAX` args, which is less than
- // `i64` max value.
+ // This will always unwrap because we've already checked that we have
+ //fewer than `MRB_FUNCALL_ARGC_MAX` args, which is less than `i64` max
+ //value.
let argslen = if let Ok(argslen) = i64::try_from(args.len()) {
argslen
} else {
@@ -93,8 +93,8 @@ impl<'a> Protect for Funcall<'a> {
}
}
-// `Eval` must be `Copy` because we may unwind past the frames in which
-// it is used with `longjmp` which does not allow Rust to run destructors.
+// `Eval` must be `Copy` because we may unwind past the frames in which it is
+ //used with `longjmp` which does not allow Rust to run destructors.
#[derive(Clone, Copy)]
struct Eval<'a> {
context: *mut sys::mrbc_context,
@@ -106,8 +106,8 @@ impl<'a> Protect for Eval<'a> {
let ptr = sys::mrb_sys_cptr_ptr(data);
let Self { context, code } = *Box::from_raw(ptr.cast::<Self>());
- // Execute arbitrary ruby code, which may generate objects with C APIs
- // if backed by Rust functions.
+ // Execute arbitrary ruby code, which may generate objects with C APIs if
+ //backed by Rust functions.
//
// `mrb_load_nstring_ctx` sets the "stack keep" field on the context
// which means the most recent value returned by eval will always be
@@ -116,8 +116,8 @@ impl<'a> Protect for Eval<'a> {
}
}
-// `BlockYield` must be `Copy` because we may unwind past the frames in which
-// it is used with `longjmp` which does not allow Rust to run destructors.
+// `BlockYield` must be `Copy` because we may unwind past the frames in which it
+ //is used with `longjmp` which does not allow Rust to run destructors.
#[derive(Clone, Copy)]
struct BlockYield {
block: sys::mrb_value,
@@ -154,8 +154,8 @@ pub enum Range {
Out,
}
-// `IsRange` must be `Copy` because we may unwind past the frames in which
-// it is used with `longjmp` which does not allow Rust to run destructors.
+// `IsRange` must be `Copy` because we may unwind past the frames in which it is
+ //used with `longjmp` which does not allow Rust to run destructors.
#[derive(Default, Debug, Clone, Copy)]
struct IsRange {
value: sys::mrb_value,
diff --git i/artichoke-backend/src/types.rs w/artichoke-backend/src/types.rs
index dcd16e8013..620930e706 100644
--- i/artichoke-backend/src/types.rs
+++ w/artichoke-backend/src/types.rs
@@ -19,14 +19,14 @@ pub fn ruby_from_mrb_value(value: sys::mrb_value) -> Ruby {
// in the `sys::mrb_vtype` enum C source.
#[allow(clippy::match_same_arms)]
match value.tt {
- // `nil` is implemented with the `MRB_TT_FALSE` type tag in mruby
- // (since both values are falsy). The difference is that Booleans are
- // non-zero `Fixnum`s.
+ // `nil` is implemented with the `MRB_TT_FALSE` type tag in mruby (since
+ //both values are falsy). The difference is that Booleans are non-zero
+ //`Fixnum`s.
MRB_TT_FALSE if unsafe { sys::mrb_sys_value_is_nil(value) } => Ruby::Nil,
MRB_TT_FALSE => Ruby::Bool,
- // `MRB_TT_FREE` is a marker type tag that indicates to the mruby
- // VM that an object is unreachable and should be deallocated by the
- // garbage collector.
+ // `MRB_TT_FREE` is a marker type tag that indicates to the mruby VM that
+ //an object is unreachable and should be deallocated by the garbage
+ //collector.
MRB_TT_FREE => Ruby::Unreachable,
MRB_TT_TRUE => Ruby::Bool,
MRB_TT_INTEGER => Ruby::Fixnum,
@@ -39,8 +39,8 @@ pub fn ruby_from_mrb_value(value: sys::mrb_value) -> Ruby {
MRB_TT_OBJECT => Ruby::Object,
MRB_TT_CLASS => Ruby::Class,
MRB_TT_MODULE => Ruby::Module,
- // `MRB_TT_ICLASS` is an internal use type tag meant for holding
- // mixed in modules.
+ // `MRB_TT_ICLASS` is an internal use type tag meant for holding mixed in
+ //modules.
MRB_TT_ICLASS => Ruby::Unreachable,
// `MRB_TT_SCLASS` represents a singleton class, or a class that is
// defined anonymously, e.g. `c1` or `c2` below:
@@ -52,8 +52,8 @@ pub fn ruby_from_mrb_value(value: sys::mrb_value) -> Ruby {
// c2 = (class <<cls; self; end)
// ```
//
- // mruby also uses the term singleton method to refer to methods
- // defined on an object's eigenclass, e.g. `bar` below:
+ // mruby also uses the term singleton method to refer to methods defined
+ //on an object's eigenclass, e.g. `bar` below:
//
// ```ruby
// class Foo; end
@@ -70,12 +70,12 @@ pub fn ruby_from_mrb_value(value: sys::mrb_value) -> Ruby {
MRB_TT_STRING => Ruby::String,
MRB_TT_RANGE => Ruby::Range,
MRB_TT_EXCEPTION => Ruby::Exception,
- // NOTE(lopopolo): This might be an internal closure symbol table,
- // rather than the `ENV` core object.
+ // NOTE(lopopolo): This might be an internal closure symbol table, rather
+ //than the `ENV` core object.
MRB_TT_ENV => Ruby::Unreachable,
- // `MRB_TT_DATA` is a type tag for wrapped C pointers. It is used
- // to indicate that an `mrb_value` has an owned pointer to an
- // external data structure stored in its `value.p` field.
+ // `MRB_TT_DATA` is a type tag for wrapped C pointers. It is used to
+ //indicate that an `mrb_value` has an owned pointer to an external data
+ //structure stored in its `value.p` field.
MRB_TT_DATA => Ruby::Data,
// NOTE(lopopolo): `Fiber`s are unimplemented in Artichoke.
MRB_TT_FIBER => Ruby::Fiber,
diff --git i/artichoke-backend/src/value.rs w/artichoke-backend/src/value.rs
index d0b71ce81a..eaf26c7fb9 100644
--- i/artichoke-backend/src/value.rs
+++ w/artichoke-backend/src/value.rs
@@ -210,8 +210,8 @@ impl ValueCore for Value {
}
fn respond_to(&self, interp: &mut Self::Artichoke, method: &str) -> Result<bool, Self::Error> {
- // Look up a method in the mruby VM's method table for this value's
- // class object.
+ // Look up a method in the mruby VM's method table for this value's class
+ //object.
let method_sym = if let Some(sym) = interp.check_interned_string(method)? {
sym
} else {
diff --git i/artichoke-core/src/class_registry.rs w/artichoke-core/src/class_registry.rs
index 56a59ca642..08d7b719a6 100644
--- i/artichoke-core/src/class_registry.rs
+++ w/artichoke-core/src/class_registry.rs
@@ -10,7 +10,8 @@ pub trait ClassRegistry {
/// Concrete value type for boxed Ruby values.
type Value;
- /// Concrete error type for errors encountered when manipulating the class registry.
+ /// Concrete error type for errors encountered when manipulating the class
+ /// registry.
type Error;
/// Type representing a class specification.
@@ -39,7 +40,8 @@ pub trait ClassRegistry {
where
T: Any;
- /// Retrieve whether a class definition exists from the state bound to Rust type `T`.
+ /// Retrieve whether a class definition exists from the state bound to Rust
+ /// type `T`.
///
/// # Errors
///
diff --git i/artichoke-core/src/convert.rs w/artichoke-core/src/convert.rs
index feb1e34755..c258a54543 100644
--- i/artichoke-core/src/convert.rs
+++ w/artichoke-core/src/convert.rs
@@ -4,8 +4,7 @@
///
/// Implementors may not allocate on the interpreter heap.
///
-/// See [`core::convert::From`].
-/// See [`ConvertMut`].
+/// See [`core::convert::From`]. See [`ConvertMut`].
pub trait Convert<T, U> {
/// Performs the infallible conversion.
fn convert(&self, from: T) -> U;
@@ -15,8 +14,7 @@ pub trait Convert<T, U> {
///
/// Implementors may not allocate on the interpreter heap.
///
-/// See [`core::convert::TryFrom`].
-/// See [`TryConvertMut`].
+/// See [`core::convert::TryFrom`]. See [`TryConvertMut`].
#[allow(clippy::module_name_repetitions)]
pub trait TryConvert<T, U> {
/// Error type for failed conversions.
@@ -35,8 +33,7 @@ pub trait TryConvert<T, U> {
///
/// Implementors may allocate on the interpreter heap.
///
-/// See [`core::convert::From`].
-/// See [`Convert`].
+/// See [`core::convert::From`]. See [`Convert`].
#[allow(clippy::module_name_repetitions)]
pub trait ConvertMut<T, U> {
/// Performs the infallible conversion.
@@ -47,8 +44,7 @@ pub trait ConvertMut<T, U> {
///
/// Implementors may allocate on the interpreter heap.
///
-/// See [`core::convert::TryFrom`].
-/// See [`TryConvert`].
+/// See [`core::convert::TryFrom`]. See [`TryConvert`].
pub trait TryConvertMut<T, U> {
/// Error type for failed conversions.
type Error;
diff --git i/artichoke-core/src/debug.rs w/artichoke-core/src/debug.rs
index c828cd82e2..fcd628ea3b 100644
--- i/artichoke-core/src/debug.rs
+++ w/artichoke-core/src/debug.rs
@@ -13,7 +13,8 @@ pub trait Debug {
/// Some immediate types like `true`, `false`, and `nil` are shown by value
/// rather than by class.
///
- /// This function suppresses all errors and returns an empty string on error.
+ /// This function suppresses all errors and returns an empty string on
+ /// error.
fn inspect_type_name_for_value(&mut self, value: Self::Value) -> &str;
/// Return the class name for the given value's type.
@@ -21,6 +22,7 @@ pub trait Debug {
/// Even immediate types will have their class name spelled out. For
/// example, calling this function with `nil` will return `"NilClass"`.
///
- /// This function suppresses all errors and returns an empty string on error.
+ /// This function suppresses all errors and returns an empty string on
+ /// error.
fn class_name_for_value(&mut self, value: Self::Value) -> &str;
}
diff --git i/artichoke-core/src/file.rs w/artichoke-core/src/file.rs
index 722b894b1a..9dd45462c7 100644
--- i/artichoke-core/src/file.rs
+++ w/artichoke-core/src/file.rs
@@ -2,8 +2,8 @@
/// Rust extension hook that can be required.
///
-/// `File`s are mounted in the interpreter file system and can modify interpreter
-/// state when they are loaded.
+/// `File`s are mounted in the interpreter file system and can modify
+/// interpreter state when they are loaded.
pub trait File {
/// Concrete type for interpreter.
type Artichoke;
diff --git i/artichoke-core/src/globals.rs w/artichoke-core/src/globals.rs
index b9217df7b5..c457cc430a 100644
--- i/artichoke-core/src/globals.rs
+++ w/artichoke-core/src/globals.rs
@@ -48,10 +48,10 @@ pub trait Globals {
///
/// # Compatibility Notes
///
- /// Getting a global that is currently may return `Ok(None)` even through
- /// a non-existent global resolves to `nil` in the Ruby VM. Consult the
- /// documentation on implementations of this trait for implementation-defined
- /// behavior.
+ /// Getting a global that is currently may return `Ok(None)` even through a
+ /// non-existent global resolves to `nil` in the Ruby VM. Consult the
+ /// documentation on implementations of this trait for
+ /// implementation-defined behavior.
///
/// # Errors
///
diff --git i/artichoke-core/src/hash.rs w/artichoke-core/src/hash.rs
index 520d8fb595..02323bb494 100644
--- i/artichoke-core/src/hash.rs
+++ w/artichoke-core/src/hash.rs
@@ -4,10 +4,10 @@ use core::hash::BuildHasher;
/// A trait for retrieving an interpreter-global [`BuildHasher`].
///
-/// The [`BuildHasher`] associated with the interpreter is for creating instances
-/// of [`Hasher`]. A `BuildHasher` is typically used (e.g., by `HashMap`) to
-/// create [`Hasher`]s for each key such that they are hashed independently of
-/// one another, since [`Hasher`]s contain state.
+/// The [`BuildHasher`] associated with the interpreter is for creating
+/// instances of [`Hasher`]. A `BuildHasher` is typically used (e.g., by
+/// `HashMap`) to create [`Hasher`]s for each key such that they are hashed
+/// independently of one another, since [`Hasher`]s contain state.
///
/// By associating one [`BuildHasher`] with the interpreter, identical Ruby
/// objects should hash identically, even if the interpreter's [`BuildHasher`]
diff --git i/artichoke-core/src/intern.rs w/artichoke-core/src/intern.rs
index ca0fa7333b..34f247e5dc 100644
--- i/artichoke-core/src/intern.rs
+++ w/artichoke-core/src/intern.rs
@@ -10,7 +10,7 @@ use alloc::borrow::Cow;
/// Store and retrieve byte strings that have the same lifetime as the
/// interpreter.
///
-/// See the [Ruby `Symbol` type][symbol].
+/// See the [Ruby `Symbol` `Symbol` type][symbol].
///
/// [symbol]: https://ruby-doc.org/core-3.1.2/Symbol.html
pub trait Intern {
diff --git i/artichoke-core/src/lib.rs w/artichoke-core/src/lib.rs
index 974e342434..a208fb35ff 100644
--- i/artichoke-core/src/lib.rs
+++ w/artichoke-core/src/lib.rs
@@ -90,11 +90,11 @@
//!
//! # Examples
//!
-//! [`artichoke-backend`](https://artichoke.github.io/artichoke/artichoke_backend/)
+//! //! [`artichoke-backend`](https://artichoke.github.io/artichoke/artichoke_backend/)
//! is one implementation of the `artichoke-core` traits.
//!
-//! To use all the APIs defined in Artichoke Core, bring the traits into
-//! scope by importing the prelude:
+//! To use all the APIs defined in Artichoke Core, bring the traits into scope
+//! by importing the prelude:
//!
//! ```
//! use artichoke_core::prelude::*;
diff --git i/artichoke-core/src/load.rs w/artichoke-core/src/load.rs
index 1494181b3f..94301cde46 100644
--- i/artichoke-core/src/load.rs
+++ w/artichoke-core/src/load.rs
@@ -79,10 +79,9 @@ impl From<Required> for bool {
/// In Ruby, `load` is stateless. All sources passed to `load` are loaded for
/// every method call.
///
-/// Each time a file is loaded, it is parsed and executed by the
-/// interpreter. If the file executes without raising an error, the file is
-/// successfully loaded and Rust callers can expect a [`Loaded::Success`]
-/// variant.
+/// Each time a file is loaded, it is parsed and executed by the interpreter. If
+/// the file executes without raising an error, the file is successfully loaded
+/// and Rust callers can expect a [`Loaded::Success`] variant.
///
/// If the file raises an exception as it is required, Rust callers can expect
/// an `Err` variant. The file is not added to the set of loaded features.
@@ -125,14 +124,14 @@ pub trait LoadSources {
/// Concrete type for errors returned by `File::require`.
type Exception;
- /// Add a Rust extension hook to the virtual file system. A stub Ruby file is
- /// added to the file system and [`File::require`] will dynamically define
- /// Ruby items when invoked via `Kernel#require`.
+ /// Add a Rust extension hook to the virtual file system. A stub Ruby file
+ /// is added to the file system and [`File::require`] will dynamically
+ /// define Ruby items when invoked via `Kernel#require`.
///
- /// If `path` is a relative path, the Ruby source is added to the
- /// file system relative to `RUBY_LOAD_PATH`. If the path is absolute, the
- /// file is placed directly on the file system. Ancestor directories are
- /// created automatically.
+ /// If `path` is a relative path, the Ruby source is added to the file
+ /// system relative to `RUBY_LOAD_PATH`. If the path is absolute, the file
+ /// is placed directly on the file system. Ancestor directories are created
+ /// automatically.
///
/// # Errors
///
@@ -146,10 +145,10 @@ pub trait LoadSources {
/// Add a Ruby source to the virtual file system.
///
- /// If `path` is a relative path, the Ruby source is added to the
- /// file system relative to `RUBY_LOAD_PATH`. If the path is absolute, the
- /// file is placed directly on the file system. Ancestor directories are
- /// created automatically.
+ /// If `path` is a relative path, the Ruby source is added to the file
+ /// system relative to `RUBY_LOAD_PATH`. If the path is absolute, the file
+ /// is placed directly on the file system. Ancestor directories are created
+ /// automatically.
///
/// # Errors
///
@@ -219,8 +218,8 @@ pub trait LoadSources {
/// Require source located at the given path.
///
- /// Query the underlying virtual file system for a source file and require it
- /// onto the interpreter. This requires files with the following steps:
+ /// Query the underlying virtual file system for a source file and require
+ /// it onto the interpreter. This requires files with the following steps:
///
/// 1. Retrieve and execute the extension hook, if any.
/// 2. Read file contents and [`eval`](crate::eval::Eval) them.
diff --git i/artichoke-core/src/module_registry.rs w/artichoke-core/src/module_registry.rs
index 0e1c9a478d..9810582513 100644
--- i/artichoke-core/src/module_registry.rs
+++ w/artichoke-core/src/module_registry.rs
@@ -10,7 +10,8 @@ pub trait ModuleRegistry {
/// Concrete value type for boxed Ruby values.
type Value;
- /// Concrete error type for errors encountered when manipulating the module registry.
+ /// Concrete error type for errors encountered when manipulating the module
+ /// registry.
type Error;
/// Type representing a module specification.
@@ -27,7 +28,8 @@ pub trait ModuleRegistry {
where
T: Any;
- /// Retrieve a module definition from the interpreter bound to Rust type `T`.
+ /// Retrieve a module definition from the interpreter bound to Rust type
+ /// `T`.
///
/// This function returns `None` if type `T` has not had a module spec
/// registered for it using [`ModuleRegistry::def_module`].
diff --git i/artichoke-core/src/parser.rs w/artichoke-core/src/parser.rs
index ac49985def..b43e9bb2cc 100644
--- i/artichoke-core/src/parser.rs
+++ w/artichoke-core/src/parser.rs
@@ -66,8 +66,8 @@ pub trait Parser {
pub enum IncrementLinenoError {
/// An overflow occurred when incrementing the line number.
///
- /// This error is reported based on the internal parser storage width
- /// and contains the max value the parser can store.
+ /// This error is reported based on the internal parser storage width and
+ /// contains the max value the parser can store.
Overflow(usize),
}
diff --git i/artichoke-core/src/regexp.rs w/artichoke-core/src/regexp.rs
index 8ccc82cefd..7f2699f678 100644
--- i/artichoke-core/src/regexp.rs
+++ w/artichoke-core/src/regexp.rs
@@ -18,8 +18,8 @@ pub trait Regexp {
///
/// Per the Ruby documentation:
///
- /// > `$1`, `$2` and so on contain text matching first, second, etc capture
- /// > group.
+ /// > `$1`, `$2` and so on contain text matching first, second, etc capture >
+ /// group.
///
/// # Errors
///
@@ -34,8 +34,8 @@ pub trait Regexp {
///
/// Per the Ruby documentation:
///
- /// > `$1`, `$2` and so on contain text matching first, second, etc capture
- /// > group.
+ /// > `$1`, `$2` and so on contain text matching first, second, etc capture >
+ /// group.
///
/// # Errors
///
diff --git i/artichoke-core/src/types.rs w/artichoke-core/src/types.rs
index 24a9f33231..5f6b8df6bd 100644
--- i/artichoke-core/src/types.rs
+++ w/artichoke-core/src/types.rs
@@ -91,8 +91,8 @@ pub enum Ruby {
Object,
/// Ruby `Proc` type.
///
- /// `Proc` is a callable closure that captures lexical scope. `Proc`s can
- /// be arbitrary arity and may or may not enforce this arity when called.
+ /// `Proc` is a callable closure that captures lexical scope. `Proc`s can be
+ /// arbitrary arity and may or may not enforce this arity when called.
Proc,
/// Ruby `Range` type.
///
diff --git i/artichoke-load-path/src/rubylib.rs w/artichoke-load-path/src/rubylib.rs
index 910fa6c856..6ad4ad3cd4 100644
--- i/artichoke-load-path/src/rubylib.rs
+++ w/artichoke-load-path/src/rubylib.rs
@@ -83,9 +83,9 @@ impl Rubylib {
/// This source loader grants access to the host file system. The `Rubylib`
/// loader does not support native extensions.
///
- /// This method returns [`None`] if there are errors resolving the
- /// `RUBYLIB` environment variable, if the `RUBYLIB` environment variable is
- /// not set, if the current working directory cannot be retrieved, or if the
+ /// This method returns [`None`] if there are errors resolving the `RUBYLIB`
+ /// environment variable, if the `RUBYLIB` environment variable is not set,
+ /// if the current working directory cannot be retrieved, or if the
/// `RUBYLIB` environment variable does not contain any paths.
///
/// [current working directory]: env::current_dir
diff --git i/mezzaluna-feature-loader/src/feature/mod.rs w/mezzaluna-feature-loader/src/feature/mod.rs
index 7b0e97aa32..c1d1fa6e09 100644
--- i/mezzaluna-feature-loader/src/feature/mod.rs
+++ w/mezzaluna-feature-loader/src/feature/mod.rs
@@ -80,9 +80,9 @@ impl Feature {
/// Get the path associated with this feature.
///
- /// The path returned by this method is not guaranteed to be the same as
- /// the path returned by [`LoadedFeatures::features`] since features may
- /// be deduplicated by their physical location in the underlying loaders.
+ /// The path returned by this method is not guaranteed to be the same as the
+ /// path returned by [`LoadedFeatures::features`] since features may be
+ /// deduplicated by their physical location in the underlying loaders.
///
/// # Examples
///
diff --git i/mezzaluna-feature-loader/src/lib.rs w/mezzaluna-feature-loader/src/lib.rs
index 73b7123a79..a77a5e17b7 100644
--- i/mezzaluna-feature-loader/src/lib.rs
+++ w/mezzaluna-feature-loader/src/lib.rs
@@ -1,7 +1,7 @@
#![warn(clippy::all)]
#![warn(clippy::pedantic)]
#![warn(clippy::cargo)]
-#![allow(clippy::question_mark)] // https://github.com/rust-lang/rust-clippy/issues/8281
+#![allow(clippy::question_mark)] // //https://github.com/rust-lang/rust-clippy/issues/8281
#![allow(unknown_lints)]
#![warn(missing_docs)]
#![warn(missing_debug_implementations)]
diff --git i/mezzaluna-feature-loader/src/loaders/disk.rs w/mezzaluna-feature-loader/src/loaders/disk.rs
index f2f8e6846b..ac7ed49baf 100644
--- i/mezzaluna-feature-loader/src/loaders/disk.rs
+++ w/mezzaluna-feature-loader/src/loaders/disk.rs
@@ -123,8 +123,8 @@ impl Disk {
/// This source loader grants access to the host file system. The `Disk`
/// loader does not support native extensions.
///
- /// This method returns [`None`] if the given `load_path` does not contain any
- /// paths.
+ /// This method returns [`None`] if the given `load_path` does not contain
+ /// any paths.
///
/// [`load_path`]: Self::load_path
/// [`set_load_path`]: Self::set_load_path
diff --git i/mezzaluna-feature-loader/src/loaders/memory.rs w/mezzaluna-feature-loader/src/loaders/memory.rs
index d1ae68f143..182750e34c 100644
--- i/mezzaluna-feature-loader/src/loaders/memory.rs
+++ w/mezzaluna-feature-loader/src/loaders/memory.rs
@@ -100,8 +100,9 @@ impl Memory {
///
/// # Panics
///
- /// If the given path is an absolute path outside of this loader's [load
- /// path], this function will panic.
+ /// If the given path is an absolute path outside of this loader's
+ /// [load
+ path], this function will panic.
///
/// If the given path has already been inserted into the in-memory file
/// system, this function will panic.
@@ -150,8 +151,9 @@ impl Memory {
///
/// # Panics
///
- /// If the given path is an absolute path outside of this loader's [load
- /// path], this function will panic.
+ /// If the given path is an absolute path outside of this loader's
+ /// [load
+ path], this function will panic.
///
/// If the given path has already been inserted into the in-memory file
/// system, this function will panic.
diff --git i/mezzaluna-feature-loader/src/loaders/rubylib.rs w/mezzaluna-feature-loader/src/loaders/rubylib.rs
index ab1d558de1..f4451a976f 100644
--- i/mezzaluna-feature-loader/src/loaders/rubylib.rs
+++ w/mezzaluna-feature-loader/src/loaders/rubylib.rs
@@ -79,9 +79,9 @@ impl Rubylib {
/// This source loader grants access to the host file system. The `Rubylib`
/// loader does not support native extensions.
///
- /// This method returns [`None`] if there are errors resolving the
- /// `RUBYLIB` environment variable, if the `RUBYLIB` environment variable is
- /// not set, if the current working directory cannot be retrieved, or if the
+ /// This method returns [`None`] if there are errors resolving the `RUBYLIB`
+ /// environment variable, if the `RUBYLIB` environment variable is not set,
+ /// if the current working directory cannot be retrieved, or if the
/// `RUBYLIB` environment variable does not contain any paths.
///
/// [current working directory]: env::current_dir
diff --git i/scolapasta-aref/src/lib.rs w/scolapasta-aref/src/lib.rs
index d2c7cdbb07..8d517ce743 100644
--- i/scolapasta-aref/src/lib.rs
+++ w/scolapasta-aref/src/lib.rs
@@ -36,7 +36,8 @@
#![no_std]
-/// Convert a signed aref offset to a `usize` index into the underlying container.
+/// Convert a signed aref offset to a `usize` index into the underlying
+/// container.
///
/// Negative indexes are interpreted as indexing from the end of the container
/// as long as their magnitude is less than the given length.
diff --git i/scolapasta-int-parse/src/error.rs w/scolapasta-int-parse/src/error.rs
index cfc3ff4ed3..a8f935e52f 100644
--- i/scolapasta-int-parse/src/error.rs
+++ w/scolapasta-int-parse/src/error.rs
@@ -170,8 +170,8 @@ pub enum InvalidRadixExceptionKind {
///
/// [`ArgumentError`]: https://ruby-doc.org/core-3.1.2/ArgumentError.html
ArgumentError,
- /// If the given radix falls outside the range of an [`i32`], the error should
- /// be mapped to a [`RangeError`]:
+ /// If the given radix falls outside the range of an [`i32`], the error
+ /// should be mapped to a [`RangeError`]:
///
/// ```console
/// [3.1.2] > begin; Integer "123", (2 ** 31 + 1); rescue => e; p e; end
diff --git i/scolapasta-int-parse/src/lib.rs w/scolapasta-int-parse/src/lib.rs
index 0045e39440..b0ab0e9e09 100644
--- i/scolapasta-int-parse/src/lib.rs
+++ w/scolapasta-int-parse/src/lib.rs
@@ -20,7 +20,8 @@
//! Parse a given byte string and optional radix into an [`i64`].
//!
-//! [`parse`] wraps [`i64::from_str_radix`] by normalizing the input byte string:
+//! [`parse`] wraps [`i64::from_str_radix`] by normalizing the input byte
+//! string:
//!
//! - Assert the byte string is ASCII and does not contain NUL bytes.
//! - Parse the radix to ensure it is in range and valid for the given input
diff --git i/scolapasta-int-parse/src/parser.rs w/scolapasta-int-parse/src/parser.rs
index 805c982159..2fe647ec76 100644
--- i/scolapasta-int-parse/src/parser.rs
+++ w/scolapasta-int-parse/src/parser.rs
@@ -46,9 +46,10 @@ impl<'a> State<'a> {
// => 21
// ```
//
- // In bases below 10, the string representation for large numbers will
- // be longer, but pre-allocating for these uncommon cases seems wasteful.
- // The `String` will reallocate if it needs to in these pathological cases.
+ // In bases below 10, the string representation for large numbers will be
+ //longer, but pre-allocating for these uncommon cases seems wasteful.
+ //The `String` will reallocate if it needs to in these pathological
+ //cases.
const PRE_ALLOCATED_DIGIT_CAPACITY: usize = 21;
match self {
diff --git i/scolapasta-int-parse/src/radix.rs w/scolapasta-int-parse/src/radix.rs
index 4a6f70b9ca..5d9b069809 100644
--- i/scolapasta-int-parse/src/radix.rs
+++ w/scolapasta-int-parse/src/radix.rs
@@ -595,10 +595,8 @@ mod tests {
#[test]
fn negative_radix_with_inline_base_and_leading_spaces_ignores() {
- // [3.1.2] > Integer " 0123", -6
- // => 83
- // [3.1.2] > Integer " 0x123", -6
- // => 291
+ // [3.1.2] > Integer " 0123", -6 => 83 [3.1.2] > Integer " 0x123", -6 =>
+ //291
let subject = " 0123".try_into().unwrap();
let radix = Radix::try_base_from_str_and_i64(subject, -6).unwrap();
assert_eq!(radix, None);
diff --git i/scolapasta-path/src/paths/windows.rs w/scolapasta-path/src/paths/windows.rs
index 3756ddb478..7bc90bb8fc 100644
--- i/scolapasta-path/src/paths/windows.rs
+++ w/scolapasta-path/src/paths/windows.rs
@@ -196,8 +196,8 @@ mod tests {
// ([]uint16=`[0xdcc0 0x2e 0x74 0x78 0x74]`)
// ```
//
- // and attempt to read it by calling `ioutil.ReadDir` and reading all
- // the files that come back.
+ // and attempt to read it by calling `ioutil.ReadDir` and reading all the
+ //files that come back.
//
// See: https://github.com/golang/go/issues/32334#issue-450436484
diff --git i/scolapasta-string-escape/src/string.rs w/scolapasta-string-escape/src/string.rs
index 315358bf22..cc40782ded 100644
--- i/scolapasta-string-escape/src/string.rs
+++ w/scolapasta-string-escape/src/string.rs
@@ -25,8 +25,7 @@ use crate::literal::{ascii_char_with_escape, Literal};
///
/// # Errors
///
-/// This method only returns an error when the given writer returns an
-/// error.
+/// This method only returns an error when the given writer returns an error.
pub fn format_debug_escape_into<W, T>(mut dest: W, message: T) -> fmt::Result
where
W: Write,
diff --git i/spinoso-array/src/array/mod.rs w/spinoso-array/src/array/mod.rs
index 0382db5e4d..f7818fc6ae 100644
--- i/spinoso-array/src/array/mod.rs
+++ w/spinoso-array/src/array/mod.rs
@@ -5,8 +5,8 @@
//! in `std`. [`SmallArray`](smallvec::SmallArray) is based on [`SmallVec`].
//! [`TinyArray`](tinyvec::TinyArray) is based on [`TinyVec`].
//!
-//! The smallvec backend uses small vector optimization to store
-//! [some elements][inline-capacity] inline without spilling to the heap.
+//! The smallvec backend uses small vector optimization to store [some
+//! elements][inline-capacity] inline without spilling to the heap.
//!
//! The `SmallArray` backend requires the `small-array` Cargo feature to be
//! enabled.
diff --git i/spinoso-array/src/array/smallvec/mod.rs w/spinoso-array/src/array/smallvec/mod.rs
index b8ddb284cc..4e77346e9f 100644
--- i/spinoso-array/src/array/smallvec/mod.rs
+++ w/spinoso-array/src/array/smallvec/mod.rs
@@ -481,7 +481,7 @@ impl<T> SmallArray<T> {
/// Returns a reference to an element at the index.
///
- /// Unlike [`Vec`], this method does not support indexing with a range. See
+ /// Unlike [`Vec`], this method does not support indexing with a range. See
/// the [`slice`](Self::slice) method for retrieving a sub-slice from the
/// array.
///
diff --git i/spinoso-array/src/array/tinyvec/mod.rs w/spinoso-array/src/array/tinyvec/mod.rs
index 8c6aea2e71..3c87deaea0 100644
--- i/spinoso-array/src/array/tinyvec/mod.rs
+++ w/spinoso-array/src/array/tinyvec/mod.rs
@@ -476,7 +476,7 @@ where
/// Returns a reference to an element at the index.
///
- /// Unlike [`Vec`], this method does not support indexing with a range. See
+ /// Unlike [`Vec`], this method does not support indexing with a range. See
/// the [`slice`](Self::slice) method for retrieving a sub-slice from the
/// array.
///
@@ -882,8 +882,8 @@ impl<T> TinyArray<T>
where
T: Clone + Default,
{
- /// Construct a new `TinyArray<T>` with length `len` and all elements set
- /// to `default`. The `TinyArray` will have capacity at least `len`.
+ /// Construct a new `TinyArray<T>` with length `len` and all elements set to
+ /// `default`. The `TinyArray` will have capacity at least `len`.
///
/// # Examples
///
diff --git i/spinoso-array/src/array/vec/mod.rs w/spinoso-array/src/array/vec/mod.rs
index 98385ed9cf..28e37ab67c 100644
--- i/spinoso-array/src/array/vec/mod.rs
+++ w/spinoso-array/src/array/vec/mod.rs
@@ -501,7 +501,7 @@ impl<T> Array<T> {
/// Returns a reference to an element at the index.
///
- /// Unlike [`Vec`], this method does not support indexing with a range. See
+ /// Unlike [`Vec`], this method does not support indexing with a range. See
/// the [`slice`](Self::slice) method for retrieving a sub-slice from the
/// array.
///
diff --git i/spinoso-array/src/lib.rs w/spinoso-array/src/lib.rs
index 6e2dc43963..3572bdb945 100644
--- i/spinoso-array/src/lib.rs
+++ w/spinoso-array/src/lib.rs
@@ -109,8 +109,8 @@
//!
//! # Panics
//!
-//! `Array`s in this crate do not expose panicking slicing operations (except for
-//! their [`Index`] and [`IndexMut`] implementations). Instead of panicking,
+//! `Array`s in this crate do not expose panicking slicing operations (except
+//! for their [`Index`] and [`IndexMut`] implementations). Instead of panicking,
//! slicing APIs operate until the end of the vector or return `&[]`. Mutating
//! APIs extend `Array`s on out of bounds access.
//!
diff --git i/spinoso-env/src/env/memory.rs w/spinoso-env/src/env/memory.rs
index 7cf4477520..20838817b2 100644
--- i/spinoso-env/src/env/memory.rs
+++ w/spinoso-env/src/env/memory.rs
@@ -84,9 +84,9 @@ impl Memory {
// https://doc.rust-lang.org/std/env/fn.set_var.html
// https://doc.rust-lang.org/std/env/fn.remove_var.html
//
- // This function may panic if key is empty, contains an ASCII equals
- // sign '=' or the NUL character '\0', or when the value contains the
- // NUL character.
+ // This function may panic if key is empty, contains an ASCII equals sign
+ //'=' or the NUL character '\0', or when the value contains the NUL
+ //character.
if name.is_empty() {
// MRI accepts empty names on get and should always return `nil`
// since empty names are invalid at the OS level.
@@ -142,9 +142,9 @@ impl Memory {
// https://doc.rust-lang.org/std/env/fn.set_var.html
// https://doc.rust-lang.org/std/env/fn.remove_var.html
//
- // This function may panic if key is empty, contains an ASCII equals
- // sign '=' or the NUL character '\0', or when the value contains the
- // NUL character.
+ // This function may panic if key is empty, contains an ASCII equals sign
+ //'=' or the NUL character '\0', or when the value contains the NUL
+ //character.
if name.find_byte(b'\0').is_some() {
let message = "bad environment variable name: contains null byte";
Err(ArgumentError::with_message(message).into())
diff --git i/spinoso-env/src/env/system.rs w/spinoso-env/src/env/system.rs
index ac25525d75..9b081534f8 100644
--- i/spinoso-env/src/env/system.rs
+++ w/spinoso-env/src/env/system.rs
@@ -80,7 +80,8 @@ impl System {
///
/// # Implementation notes
///
- /// This method accesses the host system's environment using [`env::var_os`].
+ /// This method accesses the host system's environment using
+ /// [`env::var_os`].
///
/// # Examples
///
@@ -109,9 +110,9 @@ impl System {
// https://doc.rust-lang.org/std/env/fn.set_var.html
// https://doc.rust-lang.org/std/env/fn.remove_var.html
//
- // This function may panic if key is empty, contains an ASCII equals
- // sign '=' or the NUL character '\0', or when the value contains the
- // NUL character.
+ // This function may panic if key is empty, contains an ASCII equals sign
+ //'=' or the NUL character '\0', or when the value contains the NUL
+ //character.
if name.is_empty() {
// MRI accepts empty names on get and should always return `nil`
// since empty names are invalid at the OS level.
@@ -140,8 +141,8 @@ impl System {
///
/// # Implementation notes
///
- /// This method accesses the host system's environment using [`env::set_var`]
- /// and [`env::remove_var`].
+ /// This method accesses the host system's environment using
+ /// [`env::set_var`] and [`env::remove_var`].
///
/// # Examples
///
@@ -181,9 +182,9 @@ impl System {
// https://doc.rust-lang.org/std/env/fn.set_var.html
// https://doc.rust-lang.org/std/env/fn.remove_var.html
//
- // This function may panic if key is empty, contains an ASCII equals
- // sign '=' or the NUL character '\0', or when the value contains the
- // NUL character.
+ // This function may panic if key is empty, contains an ASCII equals sign
+ //'=' or the NUL character '\0', or when the value contains the NUL
+ //character.
if name.find_byte(b'\0').is_some() {
let message = "bad environment variable name: contains null byte";
Err(ArgumentError::with_message(message).into())
@@ -222,7 +223,8 @@ impl System {
///
/// # Implementation notes
///
- /// This method accesses the host system's environment using [`env::vars_os`].
+ /// This method accesses the host system's environment using
+ /// [`env::vars_os`].
///
/// # Examples
///
diff --git i/spinoso-env/src/lib.rs w/spinoso-env/src/lib.rs
index 2d629d1212..3beef86c11 100644
--- i/spinoso-env/src/lib.rs
+++ w/spinoso-env/src/lib.rs
@@ -47,7 +47,8 @@
//!
//! # Examples
//!
-//! Using the in-memory backend allows safely manipulating an emulated environment:
+//! Using the in-memory backend allows safely manipulating an emulated
+//! environment:
//!
//! ```
//! # use spinoso_env::Memory;
@@ -186,7 +187,8 @@ impl error::Error for Error {
///
/// Argument errors have an associated message.
///
-/// This error corresponds to the [Ruby `ArgumentError` Exception class].
+/// This error corresponds to the [Ruby `ArgumentError`
+/// `ArgumentError` Exception class].
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/argumenterror.rs w/spinoso-exception/src/core/argumenterror.rs
index 276969db2c..86c5373a17 100644
--- i/spinoso-exception/src/core/argumenterror.rs
+++ w/spinoso-exception/src/core/argumenterror.rs
@@ -45,15 +45,14 @@ impl ArgumentError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"ArgumentError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `ArgumentError` Ruby exception with the given
- /// message.
+ /// Construct a new, `ArgumentError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/encodingerror.rs w/spinoso-exception/src/core/encodingerror.rs
index bce3a2e8a1..04313d98f3 100644
--- i/spinoso-exception/src/core/encodingerror.rs
+++ w/spinoso-exception/src/core/encodingerror.rs
@@ -45,15 +45,14 @@ impl EncodingError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"EncodingError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `EncodingError` Ruby exception with the given
- /// message.
+ /// Construct a new, `EncodingError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/eoferror.rs w/spinoso-exception/src/core/eoferror.rs
index 65fa57f16e..deef23437d 100644
--- i/spinoso-exception/src/core/eoferror.rs
+++ w/spinoso-exception/src/core/eoferror.rs
@@ -46,15 +46,14 @@ impl EOFError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"EOFError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `EOFError` Ruby exception with the given
- /// message.
+ /// Construct a new, `EOFError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/exception.rs w/spinoso-exception/src/core/exception.rs
index add5b17347..0fd23e2a1f 100644
--- i/spinoso-exception/src/core/exception.rs
+++ w/spinoso-exception/src/core/exception.rs
@@ -45,15 +45,14 @@ impl Exception {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"Exception";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `Exception` Ruby exception with the given
- /// message.
+ /// Construct a new, `Exception` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/fatal.rs w/spinoso-exception/src/core/fatal.rs
index ba05401c89..32e2846d41 100644
--- i/spinoso-exception/src/core/fatal.rs
+++ w/spinoso-exception/src/core/fatal.rs
@@ -45,15 +45,14 @@ impl Fatal {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"fatal";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `fatal` Ruby exception with the given
- /// message.
+ /// Construct a new, `fatal` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/fibererror.rs w/spinoso-exception/src/core/fibererror.rs
index 2a57d97961..e51fe9b622 100644
--- i/spinoso-exception/src/core/fibererror.rs
+++ w/spinoso-exception/src/core/fibererror.rs
@@ -45,15 +45,14 @@ impl FiberError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"FiberError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `FiberError` Ruby exception with the given
- /// message.
+ /// Construct a new, `FiberError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/floatdomainerror.rs w/spinoso-exception/src/core/floatdomainerror.rs
index d69464b0ff..92e7023cf4 100644
--- i/spinoso-exception/src/core/floatdomainerror.rs
+++ w/spinoso-exception/src/core/floatdomainerror.rs
@@ -45,9 +45,9 @@ impl FloatDomainError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"FloatDomainError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
diff --git i/spinoso-exception/src/core/frozenerror.rs w/spinoso-exception/src/core/frozenerror.rs
index a68be40b7b..380c7358bf 100644
--- i/spinoso-exception/src/core/frozenerror.rs
+++ w/spinoso-exception/src/core/frozenerror.rs
@@ -45,15 +45,14 @@ impl FrozenError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"FrozenError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `FrozenError` Ruby exception with the given
- /// message.
+ /// Construct a new, `FrozenError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/indexerror.rs w/spinoso-exception/src/core/indexerror.rs
index dd61dcf331..970214c051 100644
--- i/spinoso-exception/src/core/indexerror.rs
+++ w/spinoso-exception/src/core/indexerror.rs
@@ -45,15 +45,14 @@ impl IndexError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"IndexError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `IndexError` Ruby exception with the given
- /// message.
+ /// Construct a new, `IndexError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/interrupt.rs w/spinoso-exception/src/core/interrupt.rs
index f9924ca1ea..3c7fa3cdae 100644
--- i/spinoso-exception/src/core/interrupt.rs
+++ w/spinoso-exception/src/core/interrupt.rs
@@ -45,15 +45,14 @@ impl Interrupt {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"Interrupt";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `Interrupt` Ruby exception with the given
- /// message.
+ /// Construct a new, `Interrupt` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/ioerror.rs w/spinoso-exception/src/core/ioerror.rs
index 0f926d29d9..96c214ece6 100644
--- i/spinoso-exception/src/core/ioerror.rs
+++ w/spinoso-exception/src/core/ioerror.rs
@@ -46,15 +46,14 @@ impl IOError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"IOError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `IOError` Ruby exception with the given
- /// message.
+ /// Construct a new, `IOError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/keyerror.rs w/spinoso-exception/src/core/keyerror.rs
index b5049f24c3..f46ec41427 100644
--- i/spinoso-exception/src/core/keyerror.rs
+++ w/spinoso-exception/src/core/keyerror.rs
@@ -45,15 +45,14 @@ impl KeyError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"KeyError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `KeyError` Ruby exception with the given
- /// message.
+ /// Construct a new, `KeyError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/loaderror.rs w/spinoso-exception/src/core/loaderror.rs
index 93b0ce489f..c281941608 100644
--- i/spinoso-exception/src/core/loaderror.rs
+++ w/spinoso-exception/src/core/loaderror.rs
@@ -45,15 +45,14 @@ impl LoadError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"LoadError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `LoadError` Ruby exception with the given
- /// message.
+ /// Construct a new, `LoadError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/localjumperror.rs w/spinoso-exception/src/core/localjumperror.rs
index 470a9430ed..d6cd4757a2 100644
--- i/spinoso-exception/src/core/localjumperror.rs
+++ w/spinoso-exception/src/core/localjumperror.rs
@@ -45,15 +45,14 @@ impl LocalJumpError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"LocalJumpError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `LocalJumpError` Ruby exception with the given
- /// message.
+ /// Construct a new, `LocalJumpError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/nameerror.rs w/spinoso-exception/src/core/nameerror.rs
index 6a1912d8c5..83c2f72c77 100644
--- i/spinoso-exception/src/core/nameerror.rs
+++ w/spinoso-exception/src/core/nameerror.rs
@@ -45,15 +45,14 @@ impl NameError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"NameError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `NameError` Ruby exception with the given
- /// message.
+ /// Construct a new, `NameError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/nomemoryerror.rs w/spinoso-exception/src/core/nomemoryerror.rs
index c629495ed3..581db5baeb 100644
--- i/spinoso-exception/src/core/nomemoryerror.rs
+++ w/spinoso-exception/src/core/nomemoryerror.rs
@@ -45,15 +45,14 @@ impl NoMemoryError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"NoMemoryError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `NoMemoryError` Ruby exception with the given
- /// message.
+ /// Construct a new, `NoMemoryError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/nomethoderror.rs w/spinoso-exception/src/core/nomethoderror.rs
index 51eb9cc97d..f56c0e8c03 100644
--- i/spinoso-exception/src/core/nomethoderror.rs
+++ w/spinoso-exception/src/core/nomethoderror.rs
@@ -45,15 +45,14 @@ impl NoMethodError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"NoMethodError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `NoMethodError` Ruby exception with the given
- /// message.
+ /// Construct a new, `NoMethodError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/notimplementederror.rs w/spinoso-exception/src/core/notimplementederror.rs
index e736cd650e..08e355513c 100644
--- i/spinoso-exception/src/core/notimplementederror.rs
+++ w/spinoso-exception/src/core/notimplementederror.rs
@@ -45,9 +45,9 @@ impl NotImplementedError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"NotImplementedError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
diff --git i/spinoso-exception/src/core/rangeerror.rs w/spinoso-exception/src/core/rangeerror.rs
index 1559606ff4..eac71799fe 100644
--- i/spinoso-exception/src/core/rangeerror.rs
+++ w/spinoso-exception/src/core/rangeerror.rs
@@ -45,15 +45,14 @@ impl RangeError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"RangeError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `RangeError` Ruby exception with the given
- /// message.
+ /// Construct a new, `RangeError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/regexperror.rs w/spinoso-exception/src/core/regexperror.rs
index 05a44aca00..418358d434 100644
--- i/spinoso-exception/src/core/regexperror.rs
+++ w/spinoso-exception/src/core/regexperror.rs
@@ -45,15 +45,14 @@ impl RegexpError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"RegexpError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `RegexpError` Ruby exception with the given
- /// message.
+ /// Construct a new, `RegexpError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/runtimeerror.rs w/spinoso-exception/src/core/runtimeerror.rs
index 11eb629e7d..116690f327 100644
--- i/spinoso-exception/src/core/runtimeerror.rs
+++ w/spinoso-exception/src/core/runtimeerror.rs
@@ -45,15 +45,14 @@ impl RuntimeError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"RuntimeError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `RuntimeError` Ruby exception with the given
- /// message.
+ /// Construct a new, `RuntimeError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/scripterror.rs w/spinoso-exception/src/core/scripterror.rs
index c632f5a862..0322b08048 100644
--- i/spinoso-exception/src/core/scripterror.rs
+++ w/spinoso-exception/src/core/scripterror.rs
@@ -45,15 +45,14 @@ impl ScriptError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"ScriptError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `ScriptError` Ruby exception with the given
- /// message.
+ /// Construct a new, `ScriptError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/securityerror.rs w/spinoso-exception/src/core/securityerror.rs
index f8706531e6..20b5467c4f 100644
--- i/spinoso-exception/src/core/securityerror.rs
+++ w/spinoso-exception/src/core/securityerror.rs
@@ -45,15 +45,14 @@ impl SecurityError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"SecurityError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `SecurityError` Ruby exception with the given
- /// message.
+ /// Construct a new, `SecurityError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/signalexception.rs w/spinoso-exception/src/core/signalexception.rs
index 77e01b511b..28246a0382 100644
--- i/spinoso-exception/src/core/signalexception.rs
+++ w/spinoso-exception/src/core/signalexception.rs
@@ -45,9 +45,9 @@ impl SignalException {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"SignalException";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
diff --git i/spinoso-exception/src/core/standarderror.rs w/spinoso-exception/src/core/standarderror.rs
index 310e75db53..c5e8c1de78 100644
--- i/spinoso-exception/src/core/standarderror.rs
+++ w/spinoso-exception/src/core/standarderror.rs
@@ -45,15 +45,14 @@ impl StandardError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"StandardError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `StandardError` Ruby exception with the given
- /// message.
+ /// Construct a new, `StandardError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/stopiteration.rs w/spinoso-exception/src/core/stopiteration.rs
index 9653d851a6..5309cffba2 100644
--- i/spinoso-exception/src/core/stopiteration.rs
+++ w/spinoso-exception/src/core/stopiteration.rs
@@ -45,15 +45,14 @@ impl StopIteration {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"StopIteration";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `StopIteration` Ruby exception with the given
- /// message.
+ /// Construct a new, `StopIteration` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/syntaxerror.rs w/spinoso-exception/src/core/syntaxerror.rs
index 84556aba49..89784c1715 100644
--- i/spinoso-exception/src/core/syntaxerror.rs
+++ w/spinoso-exception/src/core/syntaxerror.rs
@@ -45,15 +45,14 @@ impl SyntaxError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"SyntaxError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `SyntaxError` Ruby exception with the given
- /// message.
+ /// Construct a new, `SyntaxError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/systemcallerror.rs w/spinoso-exception/src/core/systemcallerror.rs
index eac05c8bf7..8c1e8f8727 100644
--- i/spinoso-exception/src/core/systemcallerror.rs
+++ w/spinoso-exception/src/core/systemcallerror.rs
@@ -45,9 +45,9 @@ impl SystemCallError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"SystemCallError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
diff --git i/spinoso-exception/src/core/systemexit.rs w/spinoso-exception/src/core/systemexit.rs
index 96fcc43e02..cb1e6287cc 100644
--- i/spinoso-exception/src/core/systemexit.rs
+++ w/spinoso-exception/src/core/systemexit.rs
@@ -45,15 +45,14 @@ impl SystemExit {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"SystemExit";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `SystemExit` Ruby exception with the given
- /// message.
+ /// Construct a new, `SystemExit` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/systemstackerror.rs w/spinoso-exception/src/core/systemstackerror.rs
index 1d7f73b580..dc767c7539 100644
--- i/spinoso-exception/src/core/systemstackerror.rs
+++ w/spinoso-exception/src/core/systemstackerror.rs
@@ -45,9 +45,9 @@ impl SystemStackError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"SystemStackError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
diff --git i/spinoso-exception/src/core/threaderror.rs w/spinoso-exception/src/core/threaderror.rs
index 9f55fb12e2..90a09a19f5 100644
--- i/spinoso-exception/src/core/threaderror.rs
+++ w/spinoso-exception/src/core/threaderror.rs
@@ -45,15 +45,14 @@ impl ThreadError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"ThreadError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `ThreadError` Ruby exception with the given
- /// message.
+ /// Construct a new, `ThreadError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/typeerror.rs w/spinoso-exception/src/core/typeerror.rs
index f099b21a2d..591e1c9912 100644
--- i/spinoso-exception/src/core/typeerror.rs
+++ w/spinoso-exception/src/core/typeerror.rs
@@ -45,15 +45,14 @@ impl TypeError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"TypeError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
- /// Construct a new, `TypeError` Ruby exception with the given
- /// message.
+ /// Construct a new, `TypeError` Ruby exception with the given message.
///
/// # Examples
///
diff --git i/spinoso-exception/src/core/uncaughtthrowerror.rs w/spinoso-exception/src/core/uncaughtthrowerror.rs
index 3f7de347a8..9b35f69fba 100644
--- i/spinoso-exception/src/core/uncaughtthrowerror.rs
+++ w/spinoso-exception/src/core/uncaughtthrowerror.rs
@@ -45,9 +45,9 @@ impl UncaughtThrowError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"UncaughtThrowError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
diff --git i/spinoso-exception/src/core/zerodivisionerror.rs w/spinoso-exception/src/core/zerodivisionerror.rs
index 02d692e0cb..faad1c22a1 100644
--- i/spinoso-exception/src/core/zerodivisionerror.rs
+++ w/spinoso-exception/src/core/zerodivisionerror.rs
@@ -45,9 +45,9 @@ impl ZeroDivisionError {
pub const fn new() -> Self {
const DEFAULT_MESSAGE: &[u8] = b"ZeroDivisionError";
- // `Exception` objects initialized via (for example)
- // `raise RuntimeError` or `RuntimeError.new` have `message`
- // equal to the exception's class name.
+ // `Exception` objects initialized via (for example) `raise RuntimeError`
+ //or `RuntimeError.new` have `message` equal to the exception's class
+ //name.
let message = Cow::Borrowed(DEFAULT_MESSAGE);
Self { message }
}
diff --git i/spinoso-math/src/lib.rs w/spinoso-math/src/lib.rs
index 7fbc09aea2..32099630a1 100644
--- i/spinoso-math/src/lib.rs
+++ w/spinoso-math/src/lib.rs
@@ -196,9 +196,9 @@ impl error::Error for Error {
///
/// Domain errors have an associated message.
///
-/// This error corresponds to the [Ruby `Math::DomainError` Exception class]. It
-/// can be used to differentiate between [`NaN`](f64::NAN) inputs and what would
-/// be `NaN` outputs.
+/// This error corresponds to the [Ruby `Math::DomainError`
+/// `Math::DomainError` Exception class]. It can be used to differentiate
+/// between [`NaN`](f64::NAN) inputs and what would be `NaN` outputs.
///
/// # Examples
///
diff --git i/spinoso-math/src/math.rs w/spinoso-math/src/math.rs
index cd8610803a..30428d9be8 100644
--- i/spinoso-math/src/math.rs
+++ w/spinoso-math/src/math.rs
@@ -208,8 +208,8 @@ pub fn atan2(value: f64, other: f64) -> f64 {
///
/// # Errors
///
-/// If the result of computing the inverse hyperbolic tangent is [`NAN`]
-/// a domain error is returned.
+/// If the result of computing the inverse hyperbolic tangent is [`NAN`] a
+/// domain error is returned.
///
/// [`NAN`]: f64::NAN
#[inline]
@@ -486,29 +486,12 @@ pub fn gamma(value: f64) -> Result<f64, DomainError> {
// and might be an approximation so include a lookup table for as many `n`
// as can fit in the float mantissa.
const FACTORIAL_TABLE: [f64; 23] = [
- 1.0_f64, // fact(0)
- 1.0, // fact(1)
- 2.0, // fact(2)
- 6.0, // fact(3)
- 24.0, // fact(4)
- 120.0, // fact(5)
- 720.0, // fact(6)
- 5_040.0, // fact(7)
- 40_320.0, // fact(8)
- 362_880.0, // fact(9)
- 3_628_800.0, // fact(10)
- 39_916_800.0, // fact(11)
- 479_001_600.0, // fact(12)
- 6_227_020_800.0, // fact(13)
- 87_178_291_200.0, // fact(14)
- 1_307_674_368_000.0, // fact(15)
- 20_922_789_888_000.0, // fact(16)
- 355_687_428_096_000.0, // fact(17)
- 6_402_373_705_728_000.0, // fact(18)
- 121_645_100_408_832_000.0, // fact(19)
- 2_432_902_008_176_640_000.0, // fact(20)
- 51_090_942_171_709_440_000.0, // fact(21)
- 1_124_000_727_777_607_680_000.0, // fact(22)
+ 1.0_f64, // fact(0) fact(1) fact(2) fact(3)
+ //fact(4) fact(5) fact(6) fact(7)
+ //fact(8) fact(9) fact(10) fact(11)
+ //fact(12) fact(13) fact(14) fact(15)
+ //fact(16) fact(17) fact(18) fact(19)
+ //fact(20) fact(21) fact(22)
];
match value {
value if value.is_infinite() && value.is_sign_negative() => Err(DomainError::with_message(
diff --git i/spinoso-random/src/lib.rs w/spinoso-random/src/lib.rs
index 710453fdf5..c3088ddd3f 100644
--- i/spinoso-random/src/lib.rs
+++ w/spinoso-random/src/lib.rs
@@ -265,7 +265,8 @@ impl error::Error for InitializeError {}
/// This error is returned by [`urandom()`]. See its documentation for more
/// details.
///
-/// This error corresponds to the [Ruby `RuntimeError` Exception class].
+/// This error corresponds to the [Ruby `RuntimeError`
+/// `RuntimeError` Exception class].
///
/// # Examples
///
@@ -332,7 +333,8 @@ impl error::Error for UrandomError {}
/// This error is returned by [`new_seed`]. See its documentation for more
/// details.
///
-/// This error corresponds to the [Ruby `RuntimeError` Exception class].
+/// This error corresponds to the [Ruby `RuntimeError`
+/// `RuntimeError` Exception class].
///
/// # Examples
///
@@ -397,7 +399,8 @@ impl error::Error for NewSeedError {}
/// This error is returned by [`rand()`]. See its documentation for more
/// details.
///
-/// This error corresponds to the [Ruby `ArgumentError` Exception class].
+/// This error corresponds to the [Ruby `ArgumentError`
+/// `ArgumentError` Exception class].
///
/// # Examples
///
diff --git i/spinoso-regexp/src/debug.rs w/spinoso-regexp/src/debug.rs
index 794adeb4ca..d55f583fc1 100644
--- i/spinoso-regexp/src/debug.rs
+++ w/spinoso-regexp/src/debug.rs
@@ -52,8 +52,7 @@ impl Delimiters {
///
/// # Examples
///
-/// UTF-8 regexp patterns and options are formatted in a debug
-/// representation:
+/// UTF-8 regexp patterns and options are formatted in a debug representation:
///
/// ```
/// use spinoso_regexp::Debug;
@@ -95,8 +94,9 @@ pub struct Debug<'a> {
}
impl<'a> Debug<'a> {
- /// Construct a new `Debug` iterator with a regexp source, [options
- /// modifiers], and [encoding modifiers].
+ /// Construct a new `Debug` iterator with a regexp source,
+ /// [options
+ modifiers], and [encoding modifiers].
///
/// # Examples
///
@@ -199,8 +199,8 @@ impl<'a> Iterator for Debug<'a> {
self.source = &self.source[size..];
Some(ch)
}
- // Otherwise, we've gotten invalid UTF-8, which means this is not a
- // printable char.
+ // Otherwise, we've gotten invalid UTF-8, which means this is not
+ //a printable char.
None => {
let (chunk, remainder) = self.source.split_at(size);
self.source = remainder;
diff --git i/spinoso-regexp/src/encoding.rs w/spinoso-regexp/src/encoding.rs
index 879da6a0a7..179bf7d89a 100644
--- i/spinoso-regexp/src/encoding.rs
+++ w/spinoso-regexp/src/encoding.rs
@@ -32,10 +32,10 @@ impl error::Error for InvalidEncodingError {}
/// The encoding of a Regexp literal.
///
-/// Regexps are assumed to use the source encoding but literals may override
-/// the encoding with a Regexp modifier.
+/// Regexps are assumed to use the source encoding but literals may override the
+/// encoding with a Regexp modifier.
///
-/// See [`Regexp` encoding][regexp-encoding].
+/// See [`Regexp` [`Regexp` encoding][regexp-encoding].
///
/// [regexp-encoding]: https://ruby-doc.org/core-3.1.2/Regexp.html#class-Regexp-label-Encoding
#[derive(Debug, Clone, Copy, PartialOrd, Ord)]
diff --git i/spinoso-regexp/src/error.rs w/spinoso-regexp/src/error.rs
index 00aceb73f6..656a74c08a 100644
--- i/spinoso-regexp/src/error.rs
+++ w/spinoso-regexp/src/error.rs
@@ -63,7 +63,8 @@ impl error::Error for Error {
///
/// Argument errors have an associated message.
///
-/// This error corresponds to the [Ruby `ArgumentError` Exception class].
+/// This error corresponds to the [Ruby `ArgumentError`
+/// `ArgumentError` Exception class].
///
/// # Examples
///
diff --git i/spinoso-regexp/src/lib.rs w/spinoso-regexp/src/lib.rs
index d360452d54..71f4242047 100644
--- i/spinoso-regexp/src/lib.rs
+++ w/spinoso-regexp/src/lib.rs
@@ -3,8 +3,7 @@
#![warn(clippy::cargo)]
#![cfg_attr(test, allow(clippy::non_ascii_literal))]
#![allow(unknown_lints)]
-// TODO: warn on missing docs once crate is API-complete.
-// #![warn(missing_docs)]
+// TODO: warn on missing docs once crate is API-complete. #![warn(missing_docs)]
#![warn(missing_debug_implementations)]
#![warn(missing_copy_implementations)]
#![warn(rust_2018_idioms)]
diff --git i/spinoso-regexp/src/options.rs w/spinoso-regexp/src/options.rs
index b3d63ec0d5..72d0826007 100644
--- i/spinoso-regexp/src/options.rs
+++ w/spinoso-regexp/src/options.rs
@@ -112,8 +112,8 @@ impl From<u8> for Options {
impl From<i64> for Options {
/// Truncate the given `i64` to one byte and generate flags.
///
- /// See `From<u8>`. For a conversion that fails if the given `i64` is
- /// larger than [`u8::MAX`], see [`try_from_int`].
+ /// See `From<u8>`. For a conversion that fails if the given `i64` is larger
+ /// than [`u8::MAX`], see [`try_from_int`].
///
/// [`try_from_int`]: Self::try_from_int
fn from(flags: i64) -> Self {
@@ -487,7 +487,8 @@ mod tests {
#[test]
fn make_options_all_opts() {
- // `ALL_REGEXP_OPTS` is equivalent to `EXTENDED | IGNORECASE | MULTILINE` flags.
+ // `ALL_REGEXP_OPTS` is equivalent to
+ //`EXTENDED | IGNORECASE | MULTILINE` flags.
let mut opts = Options::new();
opts.flags |= Flags::ALL_REGEXP_OPTS;
assert_ne!(Options::from(Flags::EXTENDED), opts);
diff --git i/spinoso-regexp/src/regexp/regex/utf8/mod.rs w/spinoso-regexp/src/regexp/regex/utf8/mod.rs
index d623fa4c19..8fae30ccb3 100644
--- i/spinoso-regexp/src/regexp/regex/utf8/mod.rs
+++ w/spinoso-regexp/src/regexp/regex/utf8/mod.rs
@@ -215,7 +215,8 @@ impl Utf8 {
Ok(pos)
}
- /// Check whether this regexp matches the given haystack starting at an offset.
+ /// Check whether this regexp matches the given haystack starting at an
+ /// offset.
///
/// If the given offset is negative, it counts backward from the end of the
/// haystack.
@@ -392,9 +393,8 @@ mod tests {
(B("xyz"), "xyz"),
(B("🦀"), "🦀"),
(B("铁锈"), "铁锈"),
- // Invalid UTF-8 patterns are not supported 👇
- // (B(b"\xFF\xFE"), r"\xFF\xFE"),
- // (B(b"abc \xFF\xFE xyz"), r"abc \xFF\xFE xyz"),
+ // Invalid UTF-8 patterns are not supported 👇 (B(b"\xFF\xFE"),
+ //r"\xFF\xFE"), (B(b"abc \xFF\xFE xyz"), r"abc \xFF\xFE xyz"),
];
for (pattern, display) in test_cases {
let regexp = make(pattern, None, Encoding::None);
@@ -411,7 +411,8 @@ mod tests {
(B("\0"), r"/\x00/m", Options::from(Flags::MULTILINE)),
(B(b"\x0a"), "/\n/", Options::default()),
(B("\x0B"), "/\x0B/", Options::default()),
- // NOTE: the control characters, not a raw string, are in the debug output.
+ // NOTE: the control characters, not a raw string, are in the debug
+ //output.
(B("\n\r\t"), "/\n\r\t/", Options::default()),
(B("\n\r\t"), "/\n\r\t/mix", Options::from(Flags::ALL_REGEXP_OPTS)),
(
@@ -460,9 +461,9 @@ mod tests {
),
(B("铁锈"), "/铁锈/m", Options::from(Flags::MULTILINE)),
(B("铁+锈*"), "/铁+锈*/mix", Options::from(Flags::ALL_REGEXP_OPTS)),
- // Invalid UTF-8 patterns are not supported 👇
- // (B(b"\xFF\xFE"), r"\xFF\xFE", Options::default()),
- // (B(b"abc \xFF\xFE xyz"), r"abc \xFF\xFE xyz", Options::default()),
+ // Invalid UTF-8 patterns are not supported 👇 (B(b"\xFF\xFE"),
+ //r"\xFF\xFE", Options::default()), (B(b"abc \xFF\xFE xyz"), r"abc
+ //\xFF\xFE xyz", Options::default()),
];
for (pattern, debug, options) in test_cases {
let regexp = make(pattern, Some(options), Encoding::None);
diff --git i/spinoso-securerandom/src/lib.rs w/spinoso-securerandom/src/lib.rs
index 2e1c5fc642..7aa7792c4d 100644
--- i/spinoso-securerandom/src/lib.rs
+++ w/spinoso-securerandom/src/lib.rs
@@ -127,7 +127,8 @@ pub enum Error {
/// This may mean that too many random bytes were requested or the system is
/// out of memory.
///
- /// See [`TryReserveError`] and [`TryReserveErrorKind`] for more information.
+ /// See [`TryReserveError`] and [`TryReserveErrorKind`] for more
+ /// information.
///
/// [`TryReserveErrorKind`]: std::collections::TryReserveErrorKind
Memory(TryReserveError),
@@ -182,7 +183,8 @@ impl error::Error for Error {
///
/// Argument errors have an associated message.
///
-/// This error corresponds to the [Ruby `ArgumentError` Exception class].
+/// This error corresponds to the [Ruby `ArgumentError`
+/// `ArgumentError` Exception class].
///
/// # Examples
///
@@ -472,15 +474,15 @@ pub fn random_bytes(len: Option<i64>) -> Result<Vec<u8>, Error> {
pub enum Max {
/// Generate floats in the range `[0, max)`.
///
- /// If `max` is less than or equal to zero, the range defaults to floats
- /// in `[0.0, 1.0]`.
+ /// If `max` is less than or equal to zero, the range defaults to floats in
+ /// `[0.0, 1.0]`.
///
/// If `max` is [`NaN`](f64::NAN), an error is returned.
Float(f64),
/// Generate signed integers in the range `[0, max)`.
///
- /// If `max` is less than or equal to zero, the range defaults to floats
- /// in `[0.0, 1.0]`.
+ /// If `max` is less than or equal to zero, the range defaults to floats in
+ /// `[0.0, 1.0]`.
Integer(i64),
/// Generate floats in the range `[0.0, 1.0]`.
None,
@@ -679,8 +681,8 @@ pub fn urlsafe_base64(len: Option<i64>, padding: bool) -> Result<String, Error>
/// Generate a random sequence of ASCII alphanumeric bytes.
///
-/// If `len` is [`Some`] and non-negative, generate a [`String`] of `len`
-/// random ASCII alphanumeric bytes. If `len` is [`None`], generate 16 random
+/// If `len` is [`Some`] and non-negative, generate a [`String`] of `len` random
+/// ASCII alphanumeric bytes. If `len` is [`None`], generate 16 random
/// alphanumeric bytes.
///
/// The returned [`Vec<u8>`](Vec) is guaranteed to contain only ASCII bytes.
diff --git i/spinoso-securerandom/src/uuid.rs w/spinoso-securerandom/src/uuid.rs
index 719128c0cc..0b5fa40974 100644
--- i/spinoso-securerandom/src/uuid.rs
+++ w/spinoso-securerandom/src/uuid.rs
@@ -17,8 +17,7 @@ use crate::{Error, RandomBytesError};
/// [RFC 4122, Section 4.1]: https://tools.ietf.org/html/rfc4122#section-4.1
const OCTETS: usize = 16;
-// See the BNF from JDK 8 that confirms stringified UUIDs are 36 characters
-// long:
+// See the BNF from JDK 8 that confirms stringified UUIDs are 36 characters long:
//
// https://docs.oracle.com/javase/8/docs/api/java/util/UUID.html#toString--
const ENCODED_LENGTH: usize = 36;
@@ -33,7 +32,8 @@ pub fn v4() -> Result<String, Error> {
let mut bytes = [0; OCTETS];
get_random_bytes(OsRng, &mut bytes)?;
- // Per RFC 4122, Section 4.4, set bits for version and `clock_seq_hi_and_reserved`.
+ // Per RFC 4122, Section 4.4, set bits for version and
+ //`clock_seq_hi_and_reserved`.
bytes[6] = (bytes[6] & 0x0f) | 0x40;
bytes[8] = (bytes[8] & 0x3f) | 0x80;
diff --git i/spinoso-string/src/buf/nul_terminated_vec.rs w/spinoso-string/src/buf/nul_terminated_vec.rs
index 8f7abe334a..dbe0afce4d 100644
--- i/spinoso-string/src/buf/nul_terminated_vec.rs
+++ w/spinoso-string/src/buf/nul_terminated_vec.rs
@@ -15,8 +15,7 @@ fn ensure_nul_terminated(vec: &mut Vec<u8>) {
const NUL_BYTE: u8 = 0;
let spare_capacity = vec.spare_capacity_mut();
- // If the vec has spare capacity, set the first and last bytes to NUL.
- // See:
+ // If the vec has spare capacity, set the first and last bytes to NUL. See:
//
// - https://github.com/artichoke/artichoke/pull/1976#discussion_r932782264
// - https://github.com/artichoke/artichoke/blob/16c869a9ad29acfe143bfcc011917ef442ccac54/artichoke-backend/vendor/mruby/src/string.c#L36-L38
@@ -88,8 +87,8 @@ impl Deref for Buf {
impl DerefMut for Buf {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
- // SAFETY: the mutable reference given out is a slice, NOT the
- // underlying `Vec`, so the allocation cannot change size.
+ // SAFETY: the mutable reference given out is a slice, NOT the underlying
+ //`Vec`, so the allocation cannot change size.
&mut *self.inner
}
}
diff --git i/spinoso-string/src/chars.rs w/spinoso-string/src/chars.rs
index a54dbb5e20..50597bcef7 100644
--- i/spinoso-string/src/chars.rs
+++ w/spinoso-string/src/chars.rs
@@ -197,7 +197,8 @@ impl<'a> Iterator for ConventionallyUtf8<'a> {
Some(ch)
} else {
let (invalid_utf8_bytes, remainder) = self.bytes.split_at(size);
- // Invalid UTF-8 bytes are yielded as byte slices one byte at a time.
+ // Invalid UTF-8 bytes are yielded as byte slices one byte at a
+ //time.
self.invalid_bytes = InvalidBytes::with_bytes(invalid_utf8_bytes);
self.bytes = remainder;
self.invalid_bytes.next()
diff --git i/spinoso-string/src/codepoints.rs w/spinoso-string/src/codepoints.rs
index 21ba542ffd..80d3aadc3b 100644
--- i/spinoso-string/src/codepoints.rs
+++ w/spinoso-string/src/codepoints.rs
@@ -118,9 +118,9 @@ impl InvalidCodepointError {
// formatted as `0x...`.
const MESSAGE_MAX_LENGTH: usize = 27 + 2 + mem::size_of::<u32>() * 2;
let mut s = alloc::string::String::with_capacity(MESSAGE_MAX_LENGTH);
- // In practice, the errors from `write!` below are safe to ignore
- // because the `core::fmt::Write` impl for `String` will never panic
- // and these `String`s will never approach `isize::MAX` bytes.
+ // In practice, the errors from `write!` below are safe to ignore because
+ //the `core::fmt::Write` impl for `String` will never panic and these
+ //`String`s will never approach `isize::MAX` bytes.
//
// See the `core::fmt::Display` impl for `InvalidCodepointError`.
let _ = write!(s, "{}", self);
diff --git i/spinoso-string/src/enc/mod.rs w/spinoso-string/src/enc/mod.rs
index f152a7856d..a24896635c 100644
--- i/spinoso-string/src/enc/mod.rs
+++ w/spinoso-string/src/enc/mod.rs
@@ -93,9 +93,9 @@ impl Ord for EncodedString {
//
// Per the docs in `std`:
//
-// > In particular `Eq`, `Ord` and `Hash` must be equivalent for borrowed and
-// > owned values: `x.borrow() == y.borrow()` should give the same result as
-// > `x == y`.
+// > In particular `Eq`, `Ord` and `Hash` must be equivalent for borrowed and >
+ //owned values: `x.borrow() == y.borrow()` should give the same result as > `x
+//== y`.
impl Borrow<[u8]> for EncodedString {
#[inline]
fn borrow(&self) -> &[u8] {
diff --git i/spinoso-string/src/enc/utf8/mod.rs w/spinoso-string/src/enc/utf8/mod.rs
index 02a633020c..b0b3a5ce66 100644
--- i/spinoso-string/src/enc/utf8/mod.rs
+++ w/spinoso-string/src/enc/utf8/mod.rs
@@ -208,25 +208,26 @@ impl Utf8String {
#[inline]
#[must_use]
pub fn get_char(&self, index: usize) -> Option<&'_ [u8]> {
- // Fast path rejection for indexes beyond bytesize, which is
- // cheap to retrieve.
+ // Fast path rejection for indexes beyond bytesize, which is cheap to
+ //retrieve.
if index >= self.len() {
return None;
}
- // Fast path for trying to treat the conventionally UTF-8 string
- // as entirely ASCII.
+ // Fast path for trying to treat the conventionally UTF-8 string as
+ //entirely ASCII.
//
- // If the string is either all ASCII or all ASCII for a prefix
- // of the string that contains the range we wish to slice,
- // fallback to byte slicing as in the ASCII and binary fast path.
+ // If the string is either all ASCII or all ASCII for a prefix of the
+ //string that contains the range we wish to slice, fallback to byte
+ //slicing as in the ASCII and binary fast path.
let consumed = match self.inner.find_non_ascii_byte() {
None => return self.inner.get(index..=index),
Some(idx) if idx > index => return self.inner.get(index..=index),
Some(idx) => idx,
};
let mut slice = &self.inner[consumed..];
- // TODO: See if we can use `get_unchecked` as implemented in `fn char_len`
- // Count of "characters" remaining until the `index`th character.
+ // TODO: See if we can use `get_unchecked` as implemented in
+ //`fn char_len` Count of "characters" remaining until the `index`th
+ //character.
let mut remaining = index - consumed;
// This loop will terminate when either:
//
@@ -237,43 +238,39 @@ impl Utf8String {
// The loop will advance by at least one byte every iteration.
loop {
match bstr::decode_utf8(slice) {
- // If we've run out of slice while trying to find the
- // `index`th character, the lookup fails and we return `nil`.
+ // If we've run out of slice while trying to find the `index`th
+ //character, the lookup fails and we return `nil`.
(_, 0) => return None,
- // The next two arms mean we've reached the `index`th
- // character. Either return the next valid UTF-8
- // character byte slice or, if the next bytes are an
- // invalid UTF-8 sequence, the next byte.
+ // The next two arms mean we've reached the `index`th character.
+ //Either return the next valid UTF-8 character byte slice or, if
+ //the next bytes are an invalid UTF-8 sequence, the next byte.
(Some(_), size) if remaining == 0 => return Some(&slice[..size]),
- // Size is guaranteed to be positive per the first arm
- // which means this slice operation will not panic.
+ // Size is guaranteed to be positive per the first arm which
+ //means this slice operation will not panic.
(None, _) if remaining == 0 => return Some(&slice[..1]),
- // We found a single UTF-8 encoded character keep track
- // of the count and advance the substring to continue
- // decoding.
+ // We found a single UTF-8 encoded character keep track of the
+ //count and advance the substring to continue decoding.
(Some(_), size) => {
slice = &slice[size..];
remaining -= 1;
}
- // The next two arms handle the case where we have
- // encountered an invalid UTF-8 byte sequence.
+ // The next two arms handle the case where we have encountered an
+ //invalid UTF-8 byte sequence.
//
- // In this case, `decode_utf8` will return slices whose
- // length is `1..=3`. The length of this slice is the
- // number of "characters" we can advance the loop by.
+ // In this case, `decode_utf8` will return slices whose length is
+ //`1..=3`. The length of this slice is the number of
+ //"characters" we can advance the loop by.
//
- // If the invalid UTF-8 sequence contains more bytes
- // than we have remaining to get to the `index`th char,
- // then the target character is inside the invalid UTF-8
- // sequence.
+ // If the invalid UTF-8 sequence contains more bytes than we have
+ //remaining to get to the `index`th char, then the target
+ //character is inside the invalid UTF-8 sequence.
(None, size) if remaining < size => return Some(&slice[remaining..=remaining]),
- // If there are more characters remaining than the number
- // of bytes yielded in the invalid UTF-8 byte sequence,
- // count `size` bytes and advance the slice to continue
- // decoding.
+ // If there are more characters remaining than the number of
+ //bytes yielded in the invalid UTF-8 byte sequence, count `size`
+ //bytes and advance the slice to continue decoding.
(None, size) => {
slice = &slice[size..];
remaining -= size;
@@ -328,8 +325,8 @@ impl Utf8String {
return Some(&[]);
}
- // If the start of the range is beyond the character count of the
- // string, the whole lookup must fail.
+ // If the start of the range is beyond the character count of the string,
+ //the whole lookup must fail.
//
// Slice lookups where the start is just beyond the last character index
// always return an empty slice.
@@ -395,24 +392,23 @@ impl Utf8String {
_ => {}
}
- // Fast path for trying to treat the conventionally UTF-8 string
- // as entirely ASCII.
+ // Fast path for trying to treat the conventionally UTF-8 string as
+ //entirely ASCII.
//
- // If the string is either all ASCII or all ASCII for the subset
- // of the string we wish to slice, fallback to byte slicing as in
- // the ASCII and binary fast path.
+ // If the string is either all ASCII or all ASCII for the subset of the
+ //string we wish to slice, fallback to byte slicing as in the ASCII and
+ //binary fast path.
//
- // Perform the same saturate-to-end slicing mechanism if `end`
- // is beyond the character length of the string.
+ // Perform the same saturate-to-end slicing mechanism if `end` is beyond
+ //the character length of the string.
let consumed = match self.inner.find_non_ascii_byte() {
- // The entire string is ASCII, so byte indexing <=> char
- // indexing.
+ // The entire string is ASCII, so byte indexing <=> char indexing.
None => return self.inner.get(start..end).or_else(|| self.inner.get(start..)),
- // The whole substring we are interested in is ASCII, so
- // byte indexing is still valid.
+ // The whole substring we are interested in is ASCII, so byte
+ //indexing is still valid.
Some(non_ascii_byte_offset) if non_ascii_byte_offset > end => return self.get(start..end),
- // We turn non-ASCII somewhere inside before the substring
- // we're interested in, so consume that much.
+ // We turn non-ASCII somewhere inside before the substring we're
+ //interested in, so consume that much.
Some(non_ascii_byte_offset) if non_ascii_byte_offset <= start => non_ascii_byte_offset,
// This means we turn non-ASCII somewhere inside the substring.
// Consume up to start.
@@ -436,12 +432,10 @@ impl Utf8String {
// `start`th character, the lookup fails and we return `nil`.
(_, 0) => return None,
- // We found a single UTF-8 encoded character. keep track
- // of the count and advance the substring to continue
- // decoding.
+ // We found a single UTF-8 encoded character. keep track of
+ //the count and advance the substring to continue decoding.
//
- // If there's only one more to go, advance and stop the
- // loop.
+ // If there's only one more to go, advance and stop the loop.
(Some(_), size) if remaining == 1 => break &slice[size..],
// Otherwise, keep track of the character we observed and
// advance the slice to continue decoding.
@@ -457,14 +451,13 @@ impl Utf8String {
// length is `1..=3`. The length of this slice is the
// number of "characters" we can advance the loop by.
//
- // If the invalid UTF-8 sequence contains more bytes
- // than we have remaining to get to the `start`th char,
- // then we can break the loop directly.
+ // If the invalid UTF-8 sequence contains more bytes than we
+ //have remaining to get to the `start`th char, then we can
+ //break the loop directly.
(None, size) if remaining <= size => break &slice[remaining..],
- // If there are more characters remaining than the number
- // of bytes yielded in the invalid UTF-8 byte sequence,
- // count `size` bytes and advance the slice to continue
- // decoding.
+ // If there are more characters remaining than the number of
+ //bytes yielded in the invalid UTF-8 byte sequence, count
+ //`size` bytes and advance the slice to continue decoding.
(None, size) => {
slice = &slice[size..];
remaining -= size;
@@ -475,12 +468,11 @@ impl Utf8String {
// Scan the slice for the span of characters we want to return.
remaining = end - start;
- // We know `remaining` is not zero because we fast-pathed that
- // case above.
+ // We know `remaining` is not zero because we fast-pathed that case
+ //above.
debug_assert!(remaining > 0);
- // keep track of the start of the substring from the `start`th
- // character.
+ // keep track of the start of the substring from the `start`th character.
let substr = slice;
// This loop will terminate when either:
@@ -496,38 +488,36 @@ impl Utf8String {
// character, saturate the slice to the end of the string.
(_, 0) => return Some(substr),
- // We found a single UTF-8 encoded character. keep track
- // of the count and advance the substring to continue
- // decoding.
+ // We found a single UTF-8 encoded character. keep track of the
+ //count and advance the substring to continue decoding.
//
- // If there's only one more to go, advance and stop the
- // loop.
+ // If there's only one more to go, advance and stop the loop.
(Some(_), size) if remaining == 1 => {
- // Push `endth` more positive because this match has
- // the effect of shrinking `slice`.
+ // Push `endth` more positive because this match has the
+ //effect of shrinking `slice`.
let endth = substr.len() - slice.len() + size;
return Some(&substr[..endth]);
}
- // Otherwise, keep track of the character we observed and
- // advance the slice to continue decoding.
+ // Otherwise, keep track of the character we observed and advance
+ //the slice to continue decoding.
(Some(_), size) => {
slice = &slice[size..];
remaining -= 1;
}
- // The next two arms handle the case where we have
- // encountered an invalid UTF-8 byte sequence.
+ // The next two arms handle the case where we have encountered an
+ //invalid UTF-8 byte sequence.
//
- // In this case, `decode_utf8` will return slices whose
- // length is `1..=3`. The length of this slice is the
- // number of "characters" we can advance the loop by.
+ // In this case, `decode_utf8` will return slices whose length is
+ //`1..=3`. The length of this slice is the number of
+ //"characters" we can advance the loop by.
//
- // If the invalid UTF-8 sequence contains more bytes
- // than we have remaining to get to the `end`th char,
- // then we can break the loop directly.
+ // If the invalid UTF-8 sequence contains more bytes than we have
+ //remaining to get to the `end`th char, then we can break the
+ //loop directly.
(None, size) if remaining <= size => {
- // For an explanation of this arithmetic:
- // If we're trying to slice:
+ // For an explanation of this arithmetic: If we're trying to
+ //slice:
//
// ```
// s = "a\xF0\x9F\x87"
@@ -548,10 +538,9 @@ impl Utf8String {
let endth = substr.len() - slice.len() + remaining;
return Some(&substr[..endth]);
}
- // If there are more characters remaining than the number
- // of bytes yielded in the invalid UTF-8 byte sequence,
- // count `size` bytes and advance the slice to continue
- // decoding.
+ // If there are more characters remaining than the number of
+ //bytes yielded in the invalid UTF-8 byte sequence, count `size`
+ //bytes and advance the slice to continue decoding.
(None, size) => {
slice = &slice[size..];
remaining -= size;
@@ -657,19 +646,18 @@ impl Utf8String {
// Turkic or ASCII-only modes
#[inline]
pub fn make_capitalized(&mut self) {
- // This allocation assumes that in the common case, capitalizing
- // and lower-casing `char`s do not change the length of the
- // `String`.
+ // This allocation assumes that in the common case, capitalizing and
+ //lower-casing `char`s do not change the length of the `String`.
//
- // Use a `Vec` here instead of a `Buf` to ensure at most one alloc
- // fix-up happens instead of alloc fix-ups being O(chars).
+ // Use a `Vec` here instead of a `Buf` to ensure at most one alloc fix-up
+ //happens instead of alloc fix-ups being O(chars).
let mut replacement = Vec::with_capacity(self.len());
let mut bytes = self.inner.as_slice();
match bstr::decode_utf8(bytes) {
(Some(ch), size) => {
- // Converting a UTF-8 character to uppercase may yield
- // multiple codepoints.
+ // Converting a UTF-8 character to uppercase may yield multiple
+ //codepoints.
for ch in ch.to_uppercase() {
replacement.push_char(ch);
}
@@ -686,8 +674,8 @@ impl Utf8String {
while !bytes.is_empty() {
let (ch, size) = bstr::decode_utf8(bytes);
if let Some(ch) = ch {
- // Converting a UTF-8 character to lowercase may yield
- // multiple codepoints.
+ // Converting a UTF-8 character to lowercase may yield multiple
+ //codepoints.
for ch in ch.to_lowercase() {
replacement.push_char(ch);
}
@@ -703,19 +691,19 @@ impl Utf8String {
#[inline]
pub fn make_lowercase(&mut self) {
- // This allocation assumes that in the common case, lower-casing
- // `char`s do not change the length of the `String`.
+ // This allocation assumes that in the common case, lower-casing `char`s
+ //do not change the length of the `String`.
//
- // Use a `Vec` here instead of a `Buf` to ensure at most one alloc
- // fix-up happens instead of alloc fix-ups being O(chars).
+ // Use a `Vec` here instead of a `Buf` to ensure at most one alloc fix-up
+ //happens instead of alloc fix-ups being O(chars).
let mut replacement = Vec::with_capacity(self.len());
let mut bytes = self.inner.as_slice();
while !bytes.is_empty() {
let (ch, size) = bstr::decode_utf8(bytes);
if let Some(ch) = ch {
- // Converting a UTF-8 character to lowercase may yield
- // multiple codepoints.
+ // Converting a UTF-8 character to lowercase may yield multiple
+ //codepoints.
for ch in ch.to_lowercase() {
replacement.push_char(ch);
}
@@ -731,19 +719,19 @@ impl Utf8String {
#[inline]
pub fn make_uppercase(&mut self) {
- // This allocation assumes that in the common case, upper-casing
- // `char`s do not change the length of the `String`.
+ // This allocation assumes that in the common case, upper-casing `char`s
+ //do not change the length of the `String`.
//
- // Use a `Vec` here instead of a `Buf` to ensure at most one alloc
- // fix-up happens instead of alloc fix-ups being O(chars).
+ // Use a `Vec` here instead of a `Buf` to ensure at most one alloc fix-up
+ //happens instead of alloc fix-ups being O(chars).
let mut replacement = Vec::with_capacity(self.len());
let mut bytes = self.inner.as_slice();
while !bytes.is_empty() {
let (ch, size) = bstr::decode_utf8(bytes);
if let Some(ch) = ch {
- // Converting a UTF-8 character to lowercase may yield
- // multiple codepoints.
+ // Converting a UTF-8 character to lowercase may yield multiple
+ //codepoints.
for ch in ch.to_uppercase() {
replacement.push_char(ch);
}
@@ -795,8 +783,8 @@ impl Utf8String {
// FIXME: this allocation can go away if `ConventionallyUtf8` impls
// `DoubleEndedIterator`.
let chars = ConventionallyUtf8::from(&self.inner[..]).collect::<Vec<_>>();
- // Use a `Vec` here instead of a `Buf` to ensure at most one alloc
- // fix-up happens instead of alloc fix-ups being O(chars).
+ // Use a `Vec` here instead of a `Buf` to ensure at most one alloc fix-up
+ //happens instead of alloc fix-ups being O(chars).
let mut replacement = Vec::with_capacity(self.inner.len());
for &bytes in chars.iter().rev() {
replacement.extend_from_slice(bytes);
@@ -949,7 +937,7 @@ mod tests {
#[test]
fn char_len_utf8() {
- // https://github.com/minimaxir/big-list-of-naughty-strings/blob/894882e7/blns.txt#L147-L157
+ // //https://github.com/minimaxir/big-list-of-naughty-strings/blob/894882e7/blns.txt#L147-L157
let s = Utf8String::from("Ω≈ç√∫˜µ≤≥÷");
assert_eq!(s.char_len(), 10);
let s = Utf8String::from("åß∂ƒ©˙∆˚¬…æ");
@@ -978,14 +966,14 @@ mod tests {
// effectively cause rendering issues or character-length issues to
// validate product globalization readiness.
//
- // https://github.com/minimaxir/big-list-of-naughty-strings/blob/894882e7/blns.txt#L202-L224
+ // //https://github.com/minimaxir/big-list-of-naughty-strings/blob/894882e7/blns.txt#L202-L224
let s = Utf8String::from("表ポあA鷗ŒéB逍Üߪąñ丂㐀𠀀");
assert_eq!(s.char_len(), 17);
}
#[test]
fn char_len_two_byte_chars() {
- // https://github.com/minimaxir/big-list-of-naughty-strings/blob/894882e7/blns.txt#L188-L196
+ // //https://github.com/minimaxir/big-list-of-naughty-strings/blob/894882e7/blns.txt#L188-L196
let s = Utf8String::from("田中さんにあげて下さい");
assert_eq!(s.char_len(), 11);
let s = Utf8String::from("パーティーへ行かないか");
@@ -1008,19 +996,21 @@ mod tests {
#[test]
fn char_len_space_chars() {
- // Whitespace: all the characters with category `Zs`, `Zl`, or `Zp` (in Unicode
- // version 8.0.0), plus `U+0009 (HT)`, `U+000B (VT)`, `U+000C (FF)`, `U+0085 (NEL)`,
- // and `U+200B` (ZERO WIDTH SPACE), which are in the C categories but are often
- // treated as whitespace in some contexts.
+ // Whitespace: all the characters with category `Zs`, `Zl`, or `Zp` (in
+ //Unicode version 8.0.0), plus `U+0009 (HT)`, `U+000B (VT)`,
+ //`U+000C (FF)`, `U+0085 (NEL)`, and `U+200B` (ZERO WIDTH SPACE), which
+ //are in the C categories but are often treated as whitespace in some
+ //contexts.
//
- // This file unfortunately cannot express strings containing
- // `U+0000`, `U+000A`, or `U+000D` (`NUL`, `LF`, `CR`).
+ // This file unfortunately cannot express strings containing `U+0000`,
+ //`U+000A`, or `U+000D` (`NUL`, `LF`, `CR`).
//
// The next line may appear to be blank or mojibake in some viewers.
//
- // The next line may be flagged for "trailing whitespace" in some viewers.
+ // The next line may be flagged for "trailing whitespace" in some
+ //viewers.
//
- // https://github.com/minimaxir/big-list-of-naughty-strings/blob/894882e7/blns.txt#L131
+ // //https://github.com/minimaxir/big-list-of-naughty-strings/blob/894882e7/blns.txt#L131
let bytes = " � �
";
let s = Utf8String::from(bytes);
@@ -1097,7 +1087,8 @@ mod tests {
// Changes length when case changes
// https://github.com/minimaxir/big-list-of-naughty-strings/blob/894882e7/blns.txt#L226-L232
let varying_length = Utf8String::from("zȺȾ");
- // There doesn't appear to be any RTL scripts that have cases, but might as well make sure
+ // There doesn't appear to be any RTL scripts that have cases, but might
+ //as well make sure
let rtl = Utf8String::from("مرحبا الخرشوف");
let capitalize: fn(&Utf8String) -> Utf8String = |value: &Utf8String| {
@@ -1184,16 +1175,17 @@ mod tests {
//
// Per `bstr`:
//
- // The bytes `\xF0\x9F\x87` could lead to a valid UTF-8 sequence, but 3 of them
- // on their own are invalid. Only one replacement codepoint is substituted,
- // which demonstrates the "substitution of maximal subparts" strategy.
+ // The bytes `\xF0\x9F\x87` could lead to a valid UTF-8 sequence, but 3
+ //of them on their own are invalid. Only one replacement codepoint is
+ //substituted, which demonstrates the "substitution of maximal subparts"
+ //strategy.
let s = Utf8String::from(b"\xF0\x9F\x87");
assert_eq!(s.chr(), b"\xF0");
}
#[test]
fn get_char_slice_valid_range() {
- let s = Utf8String::from(b"a\xF0\x9F\x92\x8E\xFF".to_vec()); // "a💎\xFF"
+ let s = Utf8String::from(b"a\xF0\x9F\x92\x8E\xFF".to_vec()); // //"a💎\xFF"
assert_eq!(s.get_char_slice(0..0), Some(&b""[..]));
assert_eq!(s.get_char_slice(0..1), Some(&b"a"[..]));
assert_eq!(s.get_char_slice(0..2), Some("a💎".as_bytes()));
@@ -1207,7 +1199,7 @@ mod tests {
#[test]
#[allow(clippy::reversed_empty_ranges)]
fn get_char_slice_invalid_range() {
- let s = Utf8String::from(b"a\xF0\x9F\x92\x8E\xFF".to_vec()); // "a💎\xFF"
+ let s = Utf8String::from(b"a\xF0\x9F\x92\x8E\xFF".to_vec()); // //"a💎\xFF"
assert_eq!(s.get_char_slice(4..5), None);
assert_eq!(s.get_char_slice(4..1), None);
assert_eq!(s.get_char_slice(3..1), Some(&b""[..]));
diff --git i/spinoso-string/src/impls.rs w/spinoso-string/src/impls.rs
index 4b445c16d8..c232e9dae2 100644
--- i/spinoso-string/src/impls.rs
+++ w/spinoso-string/src/impls.rs
@@ -206,15 +206,15 @@ impl DerefMut for String {
}
}
-// This impl of `Borrow<[u8]>` is permissible due to the behavior of
-// `PartialEq`, `Hash`, and `Ord` impls on `String` which only rely on the byte
-// slice contents in the underlying encoded string.
+// This impl of `Borrow<[u8]>` is permissible due to the behavior of `PartialEq`,
+ //`Hash`, and `Ord` impls on `String` which only rely on the byte slice contents
+//in the underlying encoded string.
//
// Per the docs in `std`:
//
-// > In particular `Eq`, `Ord` and `Hash` must be equivalent for borrowed and
-// > owned values: `x.borrow() == y.borrow()` should give the same result as
-// > `x == y`.
+// > In particular `Eq`, `Ord` and `Hash` must be equivalent for borrowed and >
+ //owned values: `x.borrow() == y.borrow()` should give the same result as > `x
+//== y`.
impl Borrow<[u8]> for String {
#[inline]
fn borrow(&self) -> &[u8] {
diff --git i/spinoso-string/src/inspect.rs w/spinoso-string/src/inspect.rs
index 5be7b04e2b..1d02b5046c 100644
--- i/spinoso-string/src/inspect.rs
+++ w/spinoso-string/src/inspect.rs
@@ -87,9 +87,9 @@ impl<'a> Inspect<'a> {
/// Write an `Inspect` iterator into the given destination using the debug
/// representation of the byte buffer associated with a source `String`.
///
- /// This formatter writes content like `"spinoso"` and `"invalid-\xFF-utf8"`.
- /// To see example output of the underlying iterator, see the `Inspect`
- /// documentation.
+ /// This formatter writes content like `"spinoso"` and
+ /// `"invalid-\xFF-utf8"`. To see example output of the underlying iterator,
+ /// see the `Inspect` documentation.
///
/// To write binary output, use [`write_into`], which requires the **std**
/// feature to be activated.
@@ -134,9 +134,9 @@ impl<'a> Inspect<'a> {
/// Write an `Inspect` iterator into the given destination using the debug
/// representation of the byte buffer associated with a source `String`.
///
- /// This formatter writes content like `"spinoso"` and `"invalid-\xFF-utf8"`.
- /// To see example output of the underlying iterator, see the `Inspect`
- /// documentation.
+ /// This formatter writes content like `"spinoso"` and
+ /// `"invalid-\xFF-utf8"`. To see example output of the underlying iterator,
+ /// see the `Inspect` documentation.
///
/// To write to a [formatter], use [`format_into`].
///
diff --git i/spinoso-string/src/iter.rs w/spinoso-string/src/iter.rs
index 67cfce8623..b6b61e4225 100644
--- i/spinoso-string/src/iter.rs
+++ w/spinoso-string/src/iter.rs
@@ -143,8 +143,8 @@ impl<'a> IterMut<'a> {
/// Views the underlying data as a subslice of the original data.
///
- /// To avoid creating `&mut` references that alias, this is forced to consume
- /// the iterator.
+ /// To avoid creating `&mut` references that alias, this is forced to
+ /// consume the iterator.
///
/// # Examples
///
diff --git i/spinoso-string/src/lib.rs w/spinoso-string/src/lib.rs
index 87bb579728..3b8f0be089 100644
--- i/spinoso-string/src/lib.rs
+++ w/spinoso-string/src/lib.rs
@@ -3,8 +3,7 @@
#![warn(clippy::cargo)]
#![cfg_attr(test, allow(clippy::non_ascii_literal))]
#![allow(unknown_lints)]
-// TODO: warn on missing docs once crate is API-complete.
-// #![warn(missing_docs)]
+// TODO: warn on missing docs once crate is API-complete. #![warn(missing_docs)]
#![warn(missing_debug_implementations)]
#![warn(missing_copy_implementations)]
#![warn(rust_2018_idioms)]
@@ -282,8 +281,8 @@ impl String {
/// If `len` is greater than the string's current length, this has no
/// effect.
///
- /// Note that this method has no effect on the allocated capacity
- /// of the string.
+ /// Note that this method has no effect on the allocated capacity of the
+ /// string.
///
/// # Examples
///
@@ -416,7 +415,8 @@ impl String {
/// using one of the safe operations instead, such as [`truncate`],
/// [`extend`], or [`clear`].
///
- /// This function can change the return value of [`String::is_valid_encoding`].
+ /// This function can change the return value of
+ /// [`String::is_valid_encoding`].
///
/// # Safety
///
@@ -805,16 +805,14 @@ impl String {
self.inner.reserve_exact(additional);
}
- /// Tries to reserve the minimum capacity for exactly `additional`
- /// elements to be inserted in the `String`. After calling
- /// `try_reserve_exact`, capacity will be greater than or equal to
- /// `self.len() + additional` if it returns `Ok(())`. Does nothing if the
- /// capacity is already sufficient.
+ /// Tries to reserve the minimum capacity for exactly `additional` elements
+ /// to be inserted in the `String`. After calling `try_reserve_exact`,
+ /// capacity will be greater than or equal to `self.len() + additional` if
+ /// it returns `Ok(())`. Does nothing if the capacity is already sufficient.
///
- /// Note that the allocator may give the collection more space than
- /// it requests. Therefore, capacity can not be relied upon to be
- /// precisely minimal. Prefer [`try_reserve`] if future insertions are
- /// expected.
+ /// Note that the allocator may give the collection more space than it
+ /// requests. Therefore, capacity can not be relied upon to be precisely
+ /// minimal. Prefer [`try_reserve`] if future insertions are expected.
///
/// # Errors
///
@@ -1050,8 +1048,8 @@ impl String {
///
/// # Examples
///
- /// For [UTF-8] strings, the given codepoint is converted to a Unicode scalar
- /// value before appending:
+ /// For [UTF-8] strings, the given codepoint is converted to a Unicode
+ /// scalar value before appending:
///
/// ```
/// use spinoso_string::String;
@@ -1356,9 +1354,9 @@ impl String {
pub fn unicode_casecmp(&self, other: &String, options: CaseFold) -> Option<bool> {
let left = self.as_slice();
let right = other.as_slice();
- // If both `String`s are conventionally UTF-8, they must be case
- // compared using the given case folding strategy. This requires the
- // `String`s be well-formed UTF-8.
+ // If both `String`s are conventionally UTF-8, they must be case compared
+ //using the given case folding strategy. This requires the `String`s be
+ //well-formed UTF-8.
if let (Encoding::Utf8, Encoding::Utf8) = (self.encoding(), other.encoding()) {
if let (Ok(left), Ok(right)) = (str::from_utf8(left), str::from_utf8(right)) {
// Both slices are UTF-8, compare with the given Unicode case
@@ -1494,8 +1492,8 @@ impl String {
#[inline]
#[must_use]
pub fn chomp<T: AsRef<[u8]>>(&mut self, separator: Option<T>) -> bool {
- // convert to a concrete type and delegate to a single `chomp` impl
- // to minimize code duplication when monomorphizing.
+ // convert to a concrete type and delegate to a single `chomp` impl to
+ //minimize code duplication when monomorphizing.
if let Some(sep) = separator {
chomp(self, Some(sep.as_ref()))
} else {
@@ -1505,7 +1503,8 @@ impl String {
/// Modifies this `String` in-place and removes the last character.
///
- /// This method returns a [`bool`] that indicates if this string was modified.
+ /// This method returns a [`bool`] that indicates if this string was
+ /// modified.
///
/// If the string ends with `\r\n`, both characters are removed. When
/// applying `chop` to an empty string, the string remains empty.
@@ -1642,18 +1641,19 @@ impl String {
if let Some(offset) = offset {
let buf = buf.get(offset..)?;
let index = buf.find(needle)?;
- // This addition is guaranteed not to overflow because the result is
- // a valid index of the underlying `Vec`.
+ // This addition is guaranteed not to overflow because the result
+ //is a valid index of the underlying `Vec`.
//
- // `self.buf.len() < isize::MAX` because `self.buf` is a `Vec` and
- // `Vec` documents `isize::MAX` as its maximum allocation size.
+ // `self.buf.len() < isize::MAX` because `self.buf` is a `Vec`
+ //and `Vec` documents `isize::MAX` as its maximum allocation
+ //size.
Some(index + offset)
} else {
buf.find(needle)
}
}
- // convert to a concrete type and delegate to a single `index` impl
- // to minimize code duplication when monomorphizing.
+ // convert to a concrete type and delegate to a single `index` impl to
+ //minimize code duplication when monomorphizing.
let needle = needle.as_ref();
inner(self.inner.as_slice(), needle, offset)
}
@@ -1670,8 +1670,8 @@ impl String {
buf.rfind(needle)
}
}
- // convert to a concrete type and delegate to a single `rindex` impl
- // to minimize code duplication when monomorphizing.
+ // convert to a concrete type and delegate to a single `rindex` impl to
+ //minimize code duplication when monomorphizing.
let needle = needle.as_ref();
inner(self.inner.as_slice(), needle, offset)
}
@@ -2034,8 +2034,8 @@ fn chomp(string: &mut String, separator: Option<&[u8]>) -> bool {
}
Some(separator) if string.inner.ends_with(separator) => {
let original_len = string.len();
- // This subtraction is guaranteed not to panic because
- // `separator` is a substring of `buf`.
+ // This subtraction is guaranteed not to panic because `separator` is
+ //a substring of `buf`.
let truncate_to_len = original_len - separator.len();
string.inner.truncate(truncate_to_len);
// Separator is non-empty and we are always truncating, so this
diff --git i/spinoso-symbol/src/casecmp/unicode.rs w/spinoso-symbol/src/casecmp/unicode.rs
index 2f0c404344..ed73820655 100644
--- i/spinoso-symbol/src/casecmp/unicode.rs
+++ w/spinoso-symbol/src/casecmp/unicode.rs
@@ -49,9 +49,9 @@ where
// Encoding mismatch, the bytes are not comparable using Unicode case
// folding.
//
- // > `nil` is returned if the two symbols have incompatible encodings,
- // > or if `other_symbol` is not a symbol.
- // > <https://ruby-doc.org/core-3.1.2/Symbol.html#method-i-casecmp-3F>
+ // > `nil` is returned if the two symbols have incompatible encodings, > or
+ //if `other_symbol` is not a symbol. >
+ //<https://ruby-doc.org/core-3.1.2/Symbol.html#method-i-casecmp-3F>
(Ok(_), Err(_)) | (Err(_), Ok(_)) => return Ok(None),
};
Ok(Some(cmp))
diff --git i/spinoso-symbol/src/ident.rs w/spinoso-symbol/src/ident.rs
index a88a8eec33..087c3147ea 100644
--- i/spinoso-symbol/src/ident.rs
+++ w/spinoso-symbol/src/ident.rs
@@ -322,7 +322,8 @@ impl TryFrom<&[u8]> for IdentifierType {
}
}
-/// Error type returned from the [`FromStr`] implementation on [`IdentifierType`].
+/// Error type returned from the [`FromStr`] implementation on
+/// [`IdentifierType`].
///
/// # Examples
///
@@ -504,8 +505,8 @@ fn is_ident_char(ch: char) -> bool {
/// Scan the [`char`]s in the input until either invalid UTF-8 or an invalid
/// ident is found. See [`is_ident_char`].
///
-/// This method returns `Some(index)` of the start of the first invalid ident
-/// or `None` if the whole input is a valid ident.
+/// This method returns `Some(index)` of the start of the first invalid ident or
+/// `None` if the whole input is a valid ident.
///
/// Empty slices are not valid idents.
#[inline]
diff --git i/spinoso-symbol/src/inspect.rs w/spinoso-symbol/src/inspect.rs
index ef056ac623..72a7b3fa6f 100644
--- i/spinoso-symbol/src/inspect.rs
+++ w/spinoso-symbol/src/inspect.rs
@@ -91,9 +91,9 @@ impl<'a> Inspect<'a> {
/// representation of the interned byte slice associated with the symbol in
/// the underlying interner.
///
- /// This formatter writes content like `:spinoso` and `:"invalid-\xFF-utf8"`.
- /// To see example output of the underlying iterator, see the `Inspect`
- /// documentation.
+ /// This formatter writes content like `:spinoso` and
+ /// `:"invalid-\xFF-utf8"`. To see example output of the underlying
+ /// iterator, see the `Inspect` documentation.
///
/// To write binary output, use [`write_into`], which requires the **std**
/// feature to be activated.
@@ -135,9 +135,9 @@ impl<'a> Inspect<'a> {
/// representation of the interned byte slice associated with the symbol in
/// the underlying interner.
///
- /// This formatter writes content like `:spinoso` and `:"invalid-\xFF-utf8"`.
- /// To see example output of the underlying iterator, see the `Inspect`
- /// documentation.
+ /// This formatter writes content like `:spinoso` and
+ /// `:"invalid-\xFF-utf8"`. To see example output of the underlying
+ /// iterator, see the `Inspect` documentation.
///
/// To write to a [formatter], use [`format_into`].
///
diff --git i/spinoso-symbol/src/lib.rs w/spinoso-symbol/src/lib.rs
index 969f76caa4..18e3731284 100644
--- i/spinoso-symbol/src/lib.rs
+++ w/spinoso-symbol/src/lib.rs
@@ -157,8 +157,8 @@ impl std::error::Error for SymbolOverflowError {}
/// Identifier bound to an interned byte string.
///
-/// A `Symbol` allows retrieving a reference to the original interned
-/// byte string. Equivalent `Symbol`s will resolve to an identical byte string.
+/// A `Symbol` allows retrieving a reference to the original interned byte
+/// string. Equivalent `Symbol`s will resolve to an identical byte string.
///
/// `Symbol`s are based on a `u32` index. They are cheap to compare and cheap to
/// copy.
@@ -176,11 +176,11 @@ impl Borrow<u32> for Symbol {
impl Symbol {
/// Construct a new `Symbol` from the given `u32`.
///
- /// `Symbol`s constructed manually may fail to resolve to an underlying
- /// byte string.
+ /// `Symbol`s constructed manually may fail to resolve to an underlying byte
+ /// string.
///
- /// `Symbol`s are not constrained to the interner which created them.
- /// No runtime checks ensure that the underlying interner is called with a
+ /// `Symbol`s are not constrained to the interner which created them. No
+ /// runtime checks ensure that the underlying interner is called with a
/// `Symbol` that the interner itself issued.
///
/// # Examples
diff --git i/spinoso-time/src/time/tzrs/convert.rs w/spinoso-time/src/time/tzrs/convert.rs
index 6874b2cc37..3ef023eed3 100644
--- i/spinoso-time/src/time/tzrs/convert.rs
+++ w/spinoso-time/src/time/tzrs/convert.rs
@@ -37,8 +37,8 @@ impl fmt::Display for Time {
impl Time {
/// Formats _time_ according to the directives in the given format string.
///
- /// Can be used to implement [`Time#strftime`]. The resulting string should be
- /// treated as an ASCII-encoded string.
+ /// Can be used to implement [`Time#strftime`]. The resulting string should
+ /// be treated as an ASCII-encoded string.
///
/// # Examples
///
diff --git i/spinoso-time/src/time/tzrs/error.rs w/spinoso-time/src/time/tzrs/error.rs
index 7473f43ccd..3f36c7928d 100644
--- i/spinoso-time/src/time/tzrs/error.rs
+++ w/spinoso-time/src/time/tzrs/error.rs
@@ -22,8 +22,8 @@ pub enum TimeError {
/// Note: [`tz::error::DateTimeError`] is only thrown from `tz-rs` when a
/// provided component value is out of range.
///
- /// Note: This is different from how MRI ruby is implemented. e.g. Second
- /// 60 is valid in MRI, and will just add an additional second instead of
+ /// Note: This is different from how MRI ruby is implemented. e.g. Second 60
+ /// is valid in MRI, and will just add an additional second instead of
/// erroring.
ComponentOutOfRangeError(DateTimeError),
@@ -103,8 +103,8 @@ impl From<TzError> for TimeError {
// Allowing matching arms due to documentation
#[allow(clippy::match_same_arms)]
match error {
- // These two are generally recoverable within the usable of `spinoso_time`
- // TzError::DateTimeError(error) => Self::from(error),
+ // These two are generally recoverable within the usable of
+ //`spinoso_time` TzError::DateTimeError(error) => Self::from(error),
TzError::ProjectDateTimeError(error) => Self::from(error),
// The rest will bleed through, but are included here for reference
diff --git i/spinoso-time/src/time/tzrs/math.rs w/spinoso-time/src/time/tzrs/math.rs
index bfc2433c44..76de1f99e4 100644
--- i/spinoso-time/src/time/tzrs/math.rs
+++ w/spinoso-time/src/time/tzrs/math.rs
@@ -74,7 +74,8 @@ impl Time {
new_nanos -= NANOS_IN_SECOND;
}
- // Rounding should never cause an error generating a new time since it's always a truncation
+ // Rounding should never cause an error generating a new time
+ //since it's always a truncation
let dt = DateTime::from_timespec_and_local(unix_time, new_nanos, local_time_type)
.expect("Could not round the datetime");
Self {
@@ -171,8 +172,8 @@ impl Time {
// Subtraction
impl Time {
- /// Subtraction — Subtracts the given duration from _time_ and returns
- /// that value as a new `Time` object.
+ /// Subtraction — Subtracts the given duration from _time_ and returns that
+ /// value as a new `Time` object.
///
/// # Errors
///
diff --git i/spinoso-time/src/time/tzrs/mod.rs w/spinoso-time/src/time/tzrs/mod.rs
index 44582c9f6c..82f03c6cdd 100644
--- i/spinoso-time/src/time/tzrs/mod.rs
+++ w/spinoso-time/src/time/tzrs/mod.rs
@@ -141,7 +141,8 @@ impl Time {
///
/// # Errors
///
- /// Can produce a [`TimeError`], generally when provided values are out of range.
+ /// Can produce a [`TimeError`], generally when provided values are out of
+ /// range.
///
/// [`Time#new`]: https://ruby-doc.org/core-3.1.2/Time.html#method-c-new
/// [`Timezone`]: https://ruby-doc.org/core-3.1.2/Time.html#class-Time-label-Timezone+argument
@@ -175,7 +176,8 @@ impl Time {
// upstream has provided a test case which means we have a test that
// simulates this failure condition and requires us to handle it.
//
- // See: https://github.com/x-hgg-x/tz-rs/issues/34#issuecomment-1206140198
+ // See:
+ //https://github.com/x-hgg-x/tz-rs/issues/34#issuecomment-1206140198
let dt = found_date_times.latest().ok_or(TimeError::Unknown)?;
Ok(Self { inner: dt, offset })
}
@@ -197,7 +199,8 @@ impl Time {
///
/// # Errors
///
- /// Can produce a [`TimeError`], however these should never been seen in regular usage.
+ /// Can produce a [`TimeError`], however these should never been seen in
+ /// regular usage.
///
/// [`Time#now`]: https://ruby-doc.org/core-3.1.2/Time.html#method-c-now
#[inline]
@@ -228,7 +231,8 @@ impl Time {
///
/// # Errors
///
- /// Can produce a [`TimeError`], however these should not be seen during regular usage.
+ /// Can produce a [`TimeError`], however these should not be seen during
+ /// regular usage.
///
/// [`Time#at`]: https://ruby-doc.org/core-3.1.2/Time.html#method-c-at
#[inline]
@@ -264,7 +268,8 @@ impl TryFrom<ToA> for Time {
///
/// # Errors
///
- /// Can produce a [`TimeError`], generally when provided values are out of range.
+ /// Can produce a [`TimeError`], generally when provided values are out of
+ /// range.
#[inline]
fn try_from(to_a: ToA) -> Result<Self> {
let offset = Offset::try_from(to_a.zone).unwrap_or_else(|_| Offset::utc());
diff --git i/spinoso-time/src/time/tzrs/offset.rs w/spinoso-time/src/time/tzrs/offset.rs
index 13b77bfc30..5290f2497e 100644
--- i/spinoso-time/src/time/tzrs/offset.rs
+++ w/spinoso-time/src/time/tzrs/offset.rs
@@ -61,8 +61,8 @@ fn local_time_zone() -> TimeZoneRef<'static> {
GMT
}
-/// Generates a [+/-]HHMM timezone format from a given number of seconds
-/// Note: the actual seconds element is effectively ignored here
+/// Generates a [+/-]HHMM timezone format from a given number of seconds Note:
+/// the actual seconds element is effectively ignored here
#[inline]
#[must_use]
fn offset_hhmm_from_seconds(seconds: i32) -> String {
@@ -311,8 +311,8 @@ impl TryFrom<&str> for Offset {
// includes all sorts of numerals, including Devanagari and
// Kannada, which don't parse into an `i32` using `FromStr`.
//
- // `[[:digit:]]` is documented to be an ASCII character class
- // for only digits 0-9.
+ // `[[:digit:]]` is documented to be an ASCII character class for
+ //only digits 0-9.
//
// See:
// - https://docs.rs/regex/latest/regex/#perl-character-classes-unicode-friendly
diff --git i/spinoso-time/src/time/tzrs/parts.rs w/spinoso-time/src/time/tzrs/parts.rs
index e02a8138a7..33a0d515e7 100644
--- i/spinoso-time/src/time/tzrs/parts.rs
+++ w/spinoso-time/src/time/tzrs/parts.rs
@@ -60,8 +60,9 @@ impl Time {
/// Returns the second of the minute (0..60) for _time_.
///
- /// Seconds range from zero to 60 to allow the system to inject [leap
- /// seconds].
+ /// Seconds range from zero to 60 to allow the system to inject
+ /// [leap
+ seconds].
///
/// Can be used to implement [`Time#sec`].
///
@@ -316,8 +317,8 @@ impl Time {
self.inner.local_time_type().is_dst()
}
- /// Returns an integer representing the day of the week, `0..=6`, with Sunday
- /// == 0.
+ /// Returns an integer representing the day of the week, `0..=6`, with
+ /// Sunday == 0.
///
/// Can be used to implement [`Time#wday`].
///
diff --git i/src/bin/airb.rs w/src/bin/airb.rs
index 47d657c252..f142194010 100644
--- i/src/bin/airb.rs
+++ w/src/bin/airb.rs
@@ -11,8 +11,8 @@
#![warn(unused_qualifications)]
#![warn(variant_size_differences)]
-//! `airb` is the Artichoke implementation of `irb` and is an interactive Ruby shell
-//! and [REPL][repl].
+//! `airb` is the Artichoke implementation of `irb` and is an interactive Ruby
+//! shell and [REPL][repl].
//!
//! `airb` is a readline enabled shell, although it does not persist history.
//!
diff --git i/src/bin/artichoke.rs w/src/bin/artichoke.rs
index 5aab468a74..2be5d61deb 100644
--- i/src/bin/artichoke.rs
+++ w/src/bin/artichoke.rs
@@ -173,7 +173,7 @@ fn command() -> Command<'static> {
//
// `ripgrep` is licensed with the MIT License Copyright (c) 2015 Andrew Gallant.
//
-// https://github.com/BurntSushi/ripgrep/blob/9f924ee187d4c62aa6ebe4903d0cfc6507a5adb5/LICENSE-MIT
+// //https://github.com/BurntSushi/ripgrep/blob/9f924ee187d4c62aa6ebe4903d0cfc6507a5adb5/LICENSE-MIT
//
// See https://github.com/artichoke/artichoke/issues/1301.
@@ -195,12 +195,12 @@ where
if err.use_stderr() {
return Err(err.into());
}
- // Explicitly ignore any error returned by write!. The most likely error
- // at this point is a broken pipe error, in which case, we want to ignore
- // it and exit quietly.
+ // Explicitly ignore any error returned by write!. The most likely error at
+ //this point is a broken pipe error, in which case, we want to ignore it and
+ //exit quietly.
//
- // (This is the point of this helper function. clap's functionality for
- // doing this will panic on a broken pipe error.)
+ // (This is the point of this helper function. clap's functionality for doing
+ //this will panic on a broken pipe error.)
let _ignored = write!(io::stdout(), "{}", err);
process::exit(0);
}
diff --git i/src/lib.rs w/src/lib.rs
index 1c574a3a75..27657f0b4a 100644
--- i/src/lib.rs
+++ w/src/lib.rs
@@ -13,9 +13,11 @@
//! Artichoke Ruby
//!
-//! This crate is a Rust and Ruby implementation of the [Ruby programming
-//! language][rubylang]. Artichoke is not production-ready, but intends to be a
-//! [MRI-compliant][rubyspec] implementation of [recent MRI Ruby][mri-target].
+//! This crate is a Rust and Ruby implementation of the
+//! [Ruby programming
+ language][rubylang]. Artichoke is not production-ready,
+//! but intends to be a [MRI-compliant][rubyspec] implementation of
+//! [recent MRI Ruby][mri-target].
//!
//! [mri-target]: https://github.com/artichoke/artichoke/blob/trunk/RUBYSPEC.md#mri-target
//!
diff --git i/src/parser.rs w/src/parser.rs
index c25cc27df2..f9eb79b410 100644
--- i/src/parser.rs
+++ w/src/parser.rs
@@ -193,8 +193,8 @@ impl<'a> Parser<'a> {
EXPR_ENDFN => false,
// jump keyword like break, return, ...
EXPR_MID => false,
- // this token is unreachable and is used to do integer math on the
- // values of `mrb_lex_state_enum`.
+ // this token is unreachable and is used to do integer math on
+ //the values of `mrb_lex_state_enum`.
EXPR_MAX_STATE => false,
};
if code_has_unterminated_expression {
@@ -216,7 +216,7 @@ impl<'a> Drop for Parser<'a> {
sys::mrb_parser_free(parser.as_mut());
});
}
- // There is no need to free `context` since it is owned by the
- // Artichoke state.
+ // There is no need to free `context` since it is owned by the Artichoke
+ //state.
}
}
diff --git i/src/ruby.rs w/src/ruby.rs
index a5710565d5..41a9d67279 100644
--- i/src/ruby.rs
+++ w/src/ruby.rs
@@ -219,9 +219,9 @@ fn load_error<P: AsRef<OsStr>>(file: P, message: &str) -> Result<String, Error>
// This function exists to provide a workaround for Artichoke not being able to
// read from the local file system.
//
-// By passing the `--with-fixture PATH` argument, this function loads the file
-// at `PATH` into memory and stores it in the interpreter bound to the
-// `$fixture` global.
+// By passing the `--with-fixture PATH` argument, this function loads the file at
+ //`PATH` into memory and stores it in the interpreter bound to the `$fixture`
+//global.
#[inline]
fn setup_fixture_hack<P: AsRef<Path>>(interp: &mut Artichoke, fixture: P) -> Result<(), Error> {
let data = if let Ok(data) = fs::read(fixture.as_ref()) {
as an aside it looks like grapheme cluster emojis are reflowed differently than prettier does. Maybe cargo-spellcheck is counting these as multiple characters?
this reflow is also broken:
diff --git i/spinoso-time/src/time/tzrs/parts.rs w/spinoso-time/src/time/tzrs/parts.rs
index e02a8138a7..33a0d515e7 100644
--- i/spinoso-time/src/time/tzrs/parts.rs
+++ w/spinoso-time/src/time/tzrs/parts.rs
@@ -60,8 +60,9 @@ impl Time {
/// Returns the second of the minute (0..60) for _time_.
///
- /// Seconds range from zero to 60 to allow the system to inject [leap
- /// seconds].
+ /// Seconds range from zero to 60 to allow the system to inject
+ /// [leap
+ seconds].
///
/// Can be used to implement [`Time#sec`].
///
@@ -316,8 +317,8 @@ impl Time {
self.inner.local_time_type().is_dst()
}
- /// Returns an integer representing the day of the week, `0..=6`, with Sunday
- /// == 0.
+ /// Returns an integer representing the day of the week, `0..=6`, with
+ /// Sunday == 0.
///
/// Can be used to implement [`Time#wday`].
///
block quotes in //
comments appear to be reflowed incorrectly as well
Graphemes are not handled, I didn't figure out a way to reliably count their length. See #143