Skip to content

Commit

Permalink
un-pub-ify some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
rtpg committed Oct 23, 2024
1 parent 48ce6c4 commit 09e8222
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/red_knot_python_semantic/src/node_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use ruff_text_size::{Ranged, TextRange};
///
/// Compares two nodes by their kind and text range.
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub struct NodeKey {
pub(crate) struct NodeKey {
kind: NodeKind,
range: TextRange,
}
Expand Down
4 changes: 2 additions & 2 deletions crates/red_knot_python_semantic/src/semantic_index/ast_ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ impl AstIdsBuilder {
}

/// Node key that can only be constructed for expressions.
pub mod node_key {
pub(crate) mod node_key {
use ruff_python_ast as ast;

use crate::node_key::NodeKey;

#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct ExpressionNodeKey(NodeKey);
pub(crate) struct ExpressionNodeKey(NodeKey);

impl From<ast::ExpressionRef<'_>> for ExpressionNodeKey {
fn from(value: ast::ExpressionRef<'_>) -> Self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::Db;
pub struct Definition<'db> {
/// The file in which the definition occurs.
#[id]
pub file: File,
pub(crate) file: File,

/// The scope in which the definition occurs.
#[id]
Expand Down Expand Up @@ -582,7 +582,7 @@ impl ExceptHandlerDefinitionKind {
}

#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct DefinitionNodeKey(pub NodeKey);
pub(crate) struct DefinitionNodeKey(pub(crate) NodeKey);

impl From<&ast::Alias> for DefinitionNodeKey {
fn from(node: &ast::Alias) -> Self {
Expand Down
1 change: 0 additions & 1 deletion crates/red_knot_python_semantic/src/types/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ fn infer_definition_types_cycle_recovery<'db>(
if category.is_binding() {
inference.bindings.insert(input, Type::Unknown);
}
db.report_untracked_read();
// TODO we don't fill in expression types for the cycle-participant definitions, which can
// later cause a panic when looking up an expression type.
inference
Expand Down
1 change: 0 additions & 1 deletion crates/red_knot_server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ impl Server {
let mut scheduler =
schedule::Scheduler::new(&mut session, worker_threads, connection.make_sender());

log_err_msg!("WELCOME TO RUFF LSP");
for msg in connection.incoming() {
if connection.handle_shutdown(&msg)? {
break;
Expand Down
5 changes: 3 additions & 2 deletions crates/red_knot_server/src/server/api/requests/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ impl BackgroundDocumentRequestHandler for GotoDefinitionHandler {
match lookup_result {
Some(DefLocation::Location { url, range }) => {
let result = Location { uri: url, range };
return Ok(Some(GotoDefinitionResponse::Array(vec![result])));
Ok(Some(GotoDefinitionResponse::Array(vec![result])))
}
Some(DefLocation::Todo { s }) => {
log_err_msg!("GOT TODO: {}", s);
Ok(None)
}
None => {
log_err_msg!("NOTHING FOUND");
Ok(None)
}
}
Ok(None)
}
}
1 change: 0 additions & 1 deletion crates/ruff_db/src/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ impl File {

pub fn try_url(&self, db: &dyn Db) -> url::Url {
let p = self.path(db);
eprintln!("TRY_URL ON {:?}", p);
match p {
FilePath::System(s) => {
url::Url::parse(&("file://".to_string() + &s.to_string())).unwrap()
Expand Down

0 comments on commit 09e8222

Please sign in to comment.