mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Merge pull request #3834 from roc-lang/rust-1.63-clippy
rust 1.63 clippy
This commit is contained in:
commit
3ca9202e3b
10 changed files with 14 additions and 19 deletions
|
@ -202,7 +202,7 @@ pub fn constrain_expr(
|
|||
let field_var = field.var;
|
||||
let loc_field_expr = &field.loc_expr;
|
||||
let (field_type, field_con) =
|
||||
constrain_field(constraints, env, field_var, &*loc_field_expr);
|
||||
constrain_field(constraints, env, field_var, loc_field_expr);
|
||||
|
||||
field_vars.push(field_var);
|
||||
field_types.insert(label.clone(), RecordField::Required(field_type));
|
||||
|
|
|
@ -451,7 +451,7 @@ fn collect_ctors(matrix: &RefPatternMatrix) -> MutMap<TagId, Union> {
|
|||
let mut ctors = MutMap::default();
|
||||
|
||||
for row in matrix {
|
||||
if let Some(Ctor(union, id, _)) = row.get(row.len() - 1) {
|
||||
if let Some(Ctor(union, id, _)) = row.last() {
|
||||
ctors.insert(*id, union.clone());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ macro_rules! run_jit_function_dynamic_type {
|
|||
// first field is a char pointer (to the error message)
|
||||
// read value, and transmute to a pointer
|
||||
let ptr_as_int = *(result as *const u64).offset(1);
|
||||
let ptr = std::mem::transmute::<u64, *mut c_char>(ptr_as_int);
|
||||
let ptr = ptr_as_int as *mut c_char;
|
||||
|
||||
// make CString (null-terminated)
|
||||
let raw = CString::from_raw(ptr);
|
||||
|
|
|
@ -293,7 +293,7 @@ fn chomp_accessor(buffer: &[u8], pos: Position) -> Result<&str, BadIdent> {
|
|||
/// a `@Token` opaque
|
||||
fn chomp_opaque_ref(buffer: &[u8], pos: Position) -> Result<&str, BadIdent> {
|
||||
// assumes the leading `@` has NOT been chomped already
|
||||
debug_assert_eq!(buffer.get(0), Some(&b'@'));
|
||||
debug_assert_eq!(buffer.first(), Some(&b'@'));
|
||||
use encode_unicode::CharExt;
|
||||
|
||||
let bad_ident = BadIdent::BadOpaqueRef;
|
||||
|
|
|
@ -14,7 +14,7 @@ pub enum NumLiteral<'a> {
|
|||
|
||||
pub fn positive_number_literal<'a>() -> impl Parser<'a, NumLiteral<'a>, ENumber> {
|
||||
move |_arena, state: State<'a>| {
|
||||
match state.bytes().get(0) {
|
||||
match state.bytes().first() {
|
||||
Some(first_byte) if (*first_byte as char).is_ascii_digit() => {
|
||||
parse_number_base(false, state.bytes(), state)
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ pub fn positive_number_literal<'a>() -> impl Parser<'a, NumLiteral<'a>, ENumber>
|
|||
|
||||
pub fn number_literal<'a>() -> impl Parser<'a, NumLiteral<'a>, ENumber> {
|
||||
move |_arena, state: State<'a>| {
|
||||
match state.bytes().get(0) {
|
||||
match state.bytes().first() {
|
||||
Some(first_byte) if *first_byte == b'-' => {
|
||||
// drop the minus
|
||||
parse_number_base(true, &state.bytes()[1..], state)
|
||||
|
@ -92,7 +92,7 @@ fn chomp_number_dec<'a>(
|
|||
return Err((Progress::NoProgress, ENumber::End, state));
|
||||
}
|
||||
|
||||
if !bytes.get(0).copied().unwrap_or_default().is_ascii_digit() {
|
||||
if !bytes.first().copied().unwrap_or_default().is_ascii_digit() {
|
||||
// we're probably actually looking at unary negation here
|
||||
return Err((Progress::NoProgress, ENumber::End, state));
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ fn chomp_number(mut bytes: &[u8]) -> (bool, usize) {
|
|||
let start_bytes_len = bytes.len();
|
||||
let mut is_float = false;
|
||||
|
||||
while let Some(byte) = bytes.get(0) {
|
||||
while let Some(byte) = bytes.first() {
|
||||
match byte {
|
||||
b'.' => {
|
||||
// skip, fix multiple `.`s in canonicalization
|
||||
|
|
|
@ -1441,7 +1441,7 @@ where
|
|||
{
|
||||
debug_assert_ne!(word, b'\n');
|
||||
|
||||
move |_arena: &'a Bump, state: State<'a>| match state.bytes().get(0) {
|
||||
move |_arena: &'a Bump, state: State<'a>| match state.bytes().first() {
|
||||
Some(x) if *x == word => {
|
||||
let state = state.advance(1);
|
||||
Ok((MadeProgress, (), state))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue