Skip to content

Commit

Permalink
ci: use rust 1.75 in CI (#5435)
Browse files Browse the repository at this point in the history
## Description

Bumps CI rust version to 1.75 and fixes new warnings popped up during
the process.
unblocks #5433
  • Loading branch information
kayagokalp authored Jan 4, 2024
1 parent bae4be8 commit bb1a627
Show file tree
Hide file tree
Showing 24 changed files with 252 additions and 256 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ concurrency:
env:
CARGO_TERM_COLOR: always
REGISTRY: ghcr.io
RUST_VERSION: 1.73.0
NIGHTLY_RUST_VERSION: nightly-2023-08-27
RUST_VERSION: 1.75.0
NIGHTLY_RUST_VERSION: nightly-2023-12-27

jobs:
build-sway-lib-core:
Expand Down
2 changes: 1 addition & 1 deletion forc/src/cli/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) fn execute_external_subcommand(
args: Vec<String>,
silent: bool,
) -> Result<process::Output> {
let cmd = args.get(0).expect("`args` must not be empty");
let cmd = args.first().expect("`args` must not be empty");
let args = &args[1..];
let path = find_external_subcommand(cmd);
let command = match path {
Expand Down
15 changes: 5 additions & 10 deletions sway-ast/src/priv_prelude.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
pub use {
crate::{
assignable::Assignable,
attribute::{Annotated, Attribute, AttributeDecl},
attribute::Annotated,
brackets::{AngleBrackets, Braces, Parens, SquareBrackets},
expr::{
asm::{AsmBlock, AsmImmediate},
op_code::Instruction,
CodeBlockContents, Expr,
},
generics::{GenericArgs, GenericParams},
intrinsics::*,
item::{
item_abi::ItemAbi,
item_configurable::ItemConfigurable,
Expand All @@ -25,22 +24,18 @@ pub use {
FnSignature, Item, ItemKind, TraitType, TypeField,
},
keywords::*,
literal::{LitBool, LitBoolType, LitChar, LitInt, LitIntType, LitString, Literal},
literal::Literal,
path::{PathExpr, PathType},
pattern::Pattern,
punctuated::Punctuated,
statement::{Statement, StatementLet},
statement::Statement,
submodule::Submodule,
token::{Group, Punct, Spacing, TokenStream, TokenTree},
ty::Ty,
where_clause::{WhereBound, WhereClause},
where_clause::WhereClause,
},
extension_trait::extension_trait,
num_bigint::BigUint,
serde::{Serialize, Serializer},
std::{
fmt, marker::PhantomData, mem, ops::ControlFlow, path::PathBuf, str::FromStr, sync::Arc,
},
serde::Serialize,
sway_types::{
ast::{Delimiter, PunctKind},
Ident, Span, Spanned,
Expand Down
12 changes: 6 additions & 6 deletions sway-core/src/asm_lang/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ fn single_reg(
});
}

let reg = match args.get(0) {
let reg = match args.first() {
Some(reg) => reg,
_ => {
return Err(
Expand Down Expand Up @@ -711,7 +711,7 @@ fn two_regs(
});
}

let (reg, reg2) = match (args.get(0), args.get(1)) {
let (reg, reg2) = match (args.first(), args.get(1)) {
(Some(reg), Some(reg2)) => (reg, reg2),
_ => {
return Err(
Expand Down Expand Up @@ -755,7 +755,7 @@ fn four_regs(
});
}

let (reg, reg2, reg3, reg4) = match (args.get(0), args.get(1), args.get(2), args.get(3)) {
let (reg, reg2, reg3, reg4) = match (args.first(), args.get(1), args.get(2), args.get(3)) {
(Some(reg), Some(reg2), Some(reg3), Some(reg4)) => (reg, reg2, reg3, reg4),
_ => {
return Err(
Expand Down Expand Up @@ -820,7 +820,7 @@ fn three_regs(
});
}

let (reg, reg2, reg3) = match (args.get(0), args.get(1), args.get(2)) {
let (reg, reg2, reg3) = match (args.first(), args.get(1), args.get(2)) {
(Some(reg), Some(reg2), Some(reg3)) => (reg, reg2, reg3),
_ => {
return Err(
Expand Down Expand Up @@ -892,7 +892,7 @@ fn single_reg_imm_18(
received: args.len(),
});
}
let reg = match args.get(0) {
let reg = match args.first() {
Some(reg) => reg,
_ => {
return Err(
Expand Down Expand Up @@ -942,7 +942,7 @@ fn two_regs_imm_12(
received: args.len(),
});
}
let (reg, reg2) = match (args.get(0), args.get(1)) {
let (reg, reg2) = match (args.first(), args.get(1)) {
(Some(reg), Some(reg2)) => (reg, reg2),
_ => {
return Err(
Expand Down
3 changes: 1 addition & 2 deletions sway-core/src/control_flow_analysis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,5 @@
mod analyze_return_paths;
mod dead_code_analysis;
mod flow_graph;
pub use analyze_return_paths::*;
pub use dead_code_analysis::*;

pub use flow_graph::*;
2 changes: 1 addition & 1 deletion sway-core/src/decl_engine/mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl DeclMapping {
let func = engines.de().get(&func_id);

let unify_check = UnifyCheck::non_dynamic_equality(engines);
if let (left, Some(right)) = (self_type, func.parameters.get(0)) {
if let (left, Some(right)) = (self_type, func.parameters.first()) {
if unify_check.check(left, right.type_argument.type_id) {
mapping.push((source_decl_ref, dest_decl_ref));
}
Expand Down
2 changes: 1 addition & 1 deletion sway-core/src/language/ty/expression/expression_variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ impl ReplaceDecls for TyExpressionVariant {
ref mut arguments,
..
} => {
let filter_type_opt = arguments.get(0).map(|(_, arg)| arg.return_type);
let filter_type_opt = arguments.first().map(|(_, arg)| arg.return_type);

if let Some(filter_type) = filter_type_opt {
let filtered_decl_mapping =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
mod function_parameter;

pub use function_parameter::*;
use sway_error::{
error::CompileError,
handler::{ErrorEmitted, Handler},
Expand Down
10 changes: 0 additions & 10 deletions sway-core/src/semantic_analysis/ast_node/declaration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,4 @@ mod trait_fn;
mod trait_type;
mod type_alias;

pub use abi::*;
pub use function::*;
pub use impl_trait::*;
pub use r#enum::*;
pub use r#struct::*;
pub use r#trait::*;
pub use storage::*;
pub(crate) use supertrait::*;
pub use trait_fn::*;
pub use trait_type::*;
pub use type_alias::*;
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ fn type_check_state_store_word(
TypeInfo::UnsignedInteger(IntegerBits::SixtyFour),
None,
));
let type_argument = type_arguments.get(0).map(|targ| {
let type_argument = type_arguments.first().map(|targ| {
let mut ctx =
ctx.with_type_annotation(type_engine.insert(engines, TypeInfo::Unknown, None));
let initial_type_info = type_engine
Expand Down Expand Up @@ -843,7 +843,7 @@ fn type_check_state_quad(
));
let number_of_slots_exp =
ty::TyExpression::type_check(handler, ctx.by_ref(), arguments[2].clone())?;
let type_argument = type_arguments.get(0).map(|targ| {
let type_argument = type_arguments.first().map(|targ| {
let mut ctx =
ctx.with_type_annotation(type_engine.insert(engines, TypeInfo::Unknown, None));
let initial_type_info = type_engine
Expand Down Expand Up @@ -1298,7 +1298,7 @@ fn type_check_smo(
}

// Type check the type argument
let type_argument = type_arguments.get(0).map(|targ| {
let type_argument = type_arguments.first().map(|targ| {
let mut ctx = ctx
.by_ref()
.with_help_text("")
Expand Down
1 change: 0 additions & 1 deletion sway-core/src/semantic_analysis/ast_node/expression/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ mod intrinsic_function;
mod match_expression;
pub mod typed_expression;

pub use intrinsic_function::*;
pub(crate) use match_expression::*;
Loading

0 comments on commit bb1a627

Please sign in to comment.