Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use_repo(zig_toolchains, "zig_sdk")
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
rust.toolchain(
edition = "2021",
versions = ["nightly/2023-12-06"],
versions = ["1.87.0"],
extra_target_triples = ["aarch64-unknown-linux-gnu"],
)

Expand Down
385 changes: 182 additions & 203 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/starpls/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ impl DefaultFileLoader {
Ok((file_id, contents))
}

fn repo_for_path<'a>(&'a self, path: &'a Path) -> Option<&str> {
fn repo_for_path<'a>(&'a self, path: &'a Path) -> Option<&'a str> {
match path.strip_prefix(&self.external_output_base) {
Ok(stripped) => stripped
.components()
Expand Down
2 changes: 1 addition & 1 deletion crates/starpls_bazel/src/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct Label<'a> {
}

impl<'a> Label<'a> {
pub fn parse(input: &'a str) -> ParseResult {
pub fn parse(input: &'a str) -> ParseResult<'a> {
Parser {
chars: input.chars(),
pos: 0,
Expand Down
2 changes: 1 addition & 1 deletion crates/starpls_hir/src/def/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl<'a> Resolver<'a> {
pub(crate) fn resolve_name(
&'a self,
name: &'a Name,
) -> Option<(ExecutionScopeId, impl Iterator<Item = SymbolDef<'a>> + '_)> {
) -> Option<(ExecutionScopeId, impl Iterator<Item = SymbolDef<'a>>)> {
let mut defs = self
.scopes_with_id()
.filter_map(move |(scope_id, scope)| {
Expand Down
12 changes: 7 additions & 5 deletions crates/starpls_hir/src/typeck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -926,10 +926,9 @@ impl Param {
HirDefParam::KwargsDict { .. }
)
}
ParamInner::IntrinsicParam { parent, index } => matches!(
parent.params(db)[index],
IntrinsicFunctionParam::KwargsDict { .. }
),
ParamInner::IntrinsicParam { parent, index } => {
matches!(parent.params(db)[index], IntrinsicFunctionParam::KwargsDict)
}
ParamInner::BuiltinParam { parent, index } => matches!(
parent.params(db)[index],
BuiltinFunctionParam::KwargsDict { .. }
Expand Down Expand Up @@ -1460,7 +1459,10 @@ pub(crate) struct Rule {
}

impl Rule {
pub(crate) fn attrs<'a>(&'a self, db: &'a dyn Db) -> impl Iterator<Item = (&Name, &Attribute)> {
pub(crate) fn attrs<'a>(
&'a self,
db: &'a dyn Db,
) -> impl Iterator<Item = (&'a Name, &'a Attribute)> {
// This chaining is done to put the `name` attribute first.
let common = common_attributes_query(db);
let mut common_attrs = match self.kind {
Expand Down
2 changes: 1 addition & 1 deletion crates/starpls_hir/src/typeck/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,7 @@ impl TyContext<'_> {
continue;
}
}
FlowNode::Unreachable { .. } => Ty::never(),
FlowNode::Unreachable => Ty::never(),
};

break Some(curr_node_ty);
Expand Down
4 changes: 2 additions & 2 deletions crates/starpls_ide/src/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ pub(crate) fn completions(
for candidate in db.list_load_candidates(&value, file_id).ok()?? {
let start = TextSize::from(
value
.rfind(&['/', ':', '@'])
.rfind(['/', ':', '@'])
.map(|start| {
if candidate.replace_trailing_slash {
start
Expand Down Expand Up @@ -569,7 +569,7 @@ impl CompletionContext {
}

fn strip_last_package_or_target(label: &str) -> &str {
if let Some(index) = label.rfind(&[':', '/']) {
if let Some(index) = label.rfind([':', '/']) {
&label[..index + 1]
} else {
label
Expand Down
1 change: 1 addition & 0 deletions crates/starpls_ide/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ pub trait FileLoader: Send + Sync + 'static {

/// Simple implementation of [`FileLoader`] backed by a HashMap.
/// Mainly used for tests.
#[allow(dead_code)]
#[derive(Default)]
pub(crate) struct SimpleFileLoader(DashMap<String, LoadFileResult>);

Expand Down
1 change: 1 addition & 0 deletions crates/starpls_intern/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ pub struct InternStorage<T: ?Sized> {
}

impl<T: ?Sized> InternStorage<T> {
#[allow(clippy::new_without_default)]
pub const fn new() -> Self {
Self {
map: OnceLock::new(),
Expand Down
15 changes: 3 additions & 12 deletions crates/starpls_parser/src/grammar/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ pub(crate) fn binary_expr(
tokens: &[SyntaxKind],
next: fn(&mut Parser) -> Option<CompletedMarker>,
) -> Option<CompletedMarker> {
let mut m = match next(p) {
Some(m) => m,
None => return None,
};
let mut m = next(p)?;

while tokens.contains(&p.current()) {
let binary_marker = m.precede(p);
Expand Down Expand Up @@ -88,10 +85,7 @@ fn and_expr(p: &mut Parser) -> Option<CompletedMarker> {

fn comparison_expr(p: &mut Parser) -> Option<CompletedMarker> {
const COMP_TOKENS: &[SyntaxKind] = &[T![==], T![!=], T![<], T![>], T![<=], T![>=], T![in]];
let mut m = match bitwise_or_expr(p) {
Some(m) => m,
None => return None,
};
let mut m = bitwise_or_expr(p)?;

loop {
let is_not_in = if COMP_TOKENS.contains(&p.current()) {
Expand Down Expand Up @@ -150,10 +144,7 @@ fn unary_expr(p: &mut Parser) -> Option<CompletedMarker> {

/// Parses a function call, subscript expression, or member access.
pub(crate) fn primary_expr(p: &mut Parser) -> Option<CompletedMarker> {
let mut m = match operand_expr(p) {
Some(m) => m,
None => return None,
};
let mut m = operand_expr(p)?;

loop {
let next = match p.current() {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "nightly-2023-12-06"
channel = "1.87.0"
2 changes: 1 addition & 1 deletion vendor/runfiles/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ pub fn find_runfiles_dir() -> Result<PathBuf> {
while let Some(ancestor) = next {
if ancestor
.file_name()
.map_or(false, |f| f.to_string_lossy().ends_with(".runfiles"))
.is_some_and(|f| f.to_string_lossy().ends_with(".runfiles"))
{
return Ok(ancestor.to_path_buf());
}
Expand Down