nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: jtablesaw/tablesaw
Pull request #600 (2019-08-15 19:12:10)

Corrected ColumnType used for checking missingValue in DateTimeColumnFormatter
Thanks for contributing.

- [X] Tick to sign-off your agreement to the [Developer Certificate of Origin (DCO) 1.1](https://developercertificate.org)

## Description

DateTimeColumnFormatter is using TimeColumnType instead of DateTimeColumnType for checking missing values leading to incorrect identification of missing values by the formatter

## Testing

Added a test of DateTimeColumn formatter including missing value



Patch:
diff --git a/core/src/main/java/tech/tablesaw/columns/datetimes/DateTimeColumnFormatter.java b/core/src/main/java/tech/tablesaw/columns/datetimes/DateTimeColumnFormatter.java
index c75db7a0..2303a98e 100644
--- a/core/src/main/java/tech/tablesaw/columns/datetimes/DateTimeColumnFormatter.java
+++ b/core/src/main/java/tech/tablesaw/columns/datetimes/DateTimeColumnFormatter.java
@@ -5,7 +5,6 @@ import static tech.tablesaw.columns.datetimes.PackedLocalDateTime.asLocalDateTim
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import javax.annotation.concurrent.Immutable;
-import tech.tablesaw.columns.times.TimeColumnType;
 
 @Immutable
 public class DateTimeColumnFormatter {
@@ -27,7 +26,7 @@ public class DateTimeColumnFormatter {
   }
 
   public String format(long value) {
-    if (value == TimeColumnType.missingValueIndicator()) {
+    if (value == DateTimeColumnType.missingValueIndicator()) {
       return missingValueString;
     }
     if (format == null) {


Test patch:
diff --git a/core/src/test/java/tech/tablesaw/api/DateTimeColumnTest.java b/core/src/test/java/tech/tablesaw/api/DateTimeColumnTest.java
index 06d245af..fc8b56e7 100644
--- a/core/src/test/java/tech/tablesaw/api/DateTimeColumnTest.java
+++ b/core/src/test/java/tech/tablesaw/api/DateTimeColumnTest.java
@@ -19,6 +19,8 @@ import static org.junit.jupiter.api.Assertions.assertNull;
 
 import java.time.LocalDateTime;
 import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
+
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
@@ -98,4 +100,13 @@ public class DateTimeColumnTest {
 
     assertEquals(3, column1.countUnique());
   }
+  
+  @Test
+  public void testFormatter() {
+	  column1.setPrintFormatter(DateTimeFormatter.ISO_LOCAL_DATE_TIME, "NaT");
+	  column1.append(LocalDateTime.of(2000, 1, 1, 0, 0));
+	  column1.appendMissing();
+	  assertEquals("2000-01-01T00:00:00", column1.getString(0));
+	  assertEquals("NaT", column1.getString(1));
+  }
 }
Repository: jtablesaw/tablesaw
Pull request #699 (2019-10-29 16:47:27)

Escapes quotes when building Javascript string arrays from Java arrays
Thanks for contributing.

- [x] Tick to sign-off your agreement to the [Developer Certificate of Origin (DCO) 1.1](https://developercertificate.org)

## Description

The generated plot Javascript is not valid if any of the values has a quote ( `'` ) in it. This PR escapes quotes before generating the JS arrays.

## Testing

Yes.



Patch:
diff --git a/jsplot/src/main/java/tech/tablesaw/plotly/Utils.java b/jsplot/src/main/java/tech/tablesaw/plotly/Utils.java
index 3267a0e6..a9fafec8 100644
--- a/jsplot/src/main/java/tech/tablesaw/plotly/Utils.java
+++ b/jsplot/src/main/java/tech/tablesaw/plotly/Utils.java
@@ -8,16 +8,22 @@ public class Utils {
     return Arrays.toString(data);
   }
 
+  /** @return un-escaped quote of argument */
   public static String quote(String string) {
     return "'" + string + "'";
   }
 
+  private static String escape(String s) {
+    return s.replaceAll("\\'", "\\\\'");
+  }
+
+  /** @return a Javascript array of strings (escaped if needed) */
   public static String dataAsString(Object[] data) {
     StringBuilder builder = new StringBuilder("[");
     for (int i = 0; i < data.length; i++) {
       Object o = data[i];
       builder.append("'");
-      builder.append(o);
+      builder.append(escape(String.valueOf(o)));
       builder.append("'");
       if (i < data.length - 1) {
         builder.append(",");


Test patch:
diff --git a/jsplot/src/test/java/tech/tablesaw/plotly/UtilsTest.java b/jsplot/src/test/java/tech/tablesaw/plotly/UtilsTest.java
new file mode 100644
index 00000000..6c7b2ef5
--- /dev/null
+++ b/jsplot/src/test/java/tech/tablesaw/plotly/UtilsTest.java
@@ -0,0 +1,13 @@
+package tech.tablesaw.plotly;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import org.junit.jupiter.api.Test;
+
+public class UtilsTest {
+
+  @Test
+  public void testEscapeQuote() {
+    String s = Utils.dataAsString(new String[] {"Bobby's tables"});
+    assertTrue(s.contains("\\"));
+  }
+}
Repository: jtablesaw/tablesaw
Pull request #742 (2020-01-18 19:59:56)

Change StringColumn summary to a more useful fixed format #718

Thanks for contributing.

- [ X] Tick to sign-off your agreement to the [Developer Certificate of Origin (DCO) 1.1](https://developercertificate.org)

## Description

This is a pre-requisite for the larger change to change Relation.summary() to return a Table.
This changes the summary for the StringColumn to provide statistics in a fixed format. This is similar to the Python pandas implementation.

## Testing

Added a test for summary



Patch:
diff --git a/core/src/main/java/tech/tablesaw/api/StringColumn.java b/core/src/main/java/tech/tablesaw/api/StringColumn.java
index ce2b0dd6..12522e48 100644
--- a/core/src/main/java/tech/tablesaw/api/StringColumn.java
+++ b/core/src/main/java/tech/tablesaw/api/StringColumn.java
@@ -182,7 +182,25 @@ public class StringColumn extends AbstractStringColumn<StringColumn> {
 
   @Override
   public Table summary() {
-    return countByCategory();
+    Table summary = Table.create(this.name());
+    StringColumn measure = StringColumn.create("Measure");
+    StringColumn value = StringColumn.create("Value");
+    summary.addColumns(measure);
+    summary.addColumns(value);
+
+    measure.append("Count");
+    value.append(String.valueOf(size()));
+
+    measure.append("Unique");
+    value.append(String.valueOf(countUnique()));
+
+    Table countByCategory = countByCategory().sortDescendingOn("Count");
+    measure.append("Top");
+    value.append(countByCategory.stringColumn("Category").getString(0));
+
+    measure.append("Top Freq.");
+    value.appendObj(countByCategory.intColumn("Count").getString(0));
+    return summary;
   }
 
   /** */


Test patch:
diff --git a/core/src/test/java/tech/tablesaw/api/StringColumnTest.java b/core/src/test/java/tech/tablesaw/api/StringColumnTest.java
index 4795c9cf..3a237154 100644
--- a/core/src/test/java/tech/tablesaw/api/StringColumnTest.java
+++ b/core/src/test/java/tech/tablesaw/api/StringColumnTest.java
@@ -716,4 +716,19 @@ class StringColumnTest {
     assertEquals(3, col1.countUnique());
     assertEquals(3, col1.unique().size());
   }
+
+  @Test
+  public void testSummary() {
+    Table summary = column.summary();
+    assertEquals(2, summary.columnCount());
+    assertEquals(4, summary.rowCount());
+    assertEquals("Count", summary.getUnformatted(0, 0));
+    assertEquals("4", summary.getUnformatted(0, 1));
+    assertEquals("Unique", summary.getUnformatted(1, 0));
+    assertEquals("4", summary.getUnformatted(1, 1));
+    assertEquals("Top", summary.getUnformatted(2, 0));
+    assertEquals("Value 4", summary.getUnformatted(2, 1));
+    assertEquals("Top Freq.", summary.getUnformatted(3, 0));
+    assertEquals("1", summary.getUnformatted(3, 1));
+  }
 }
Repository: jtablesaw/tablesaw
Pull request #799 (2020-05-07 16:22:40)

Fix NPE in ColumnType.compare
Thanks for contributing.

- [X] Tick to sign-off your agreement to the [Developer Certificate of Origin (DCO) 1.1](https://developercertificate.org)

## Testing

Did you add a unit test?

yes


Patch:
diff --git a/core/src/main/java/tech/tablesaw/api/ColumnType.java b/core/src/main/java/tech/tablesaw/api/ColumnType.java
index 24d20d44..5525a0ac 100644
--- a/core/src/main/java/tech/tablesaw/api/ColumnType.java
+++ b/core/src/main/java/tech/tablesaw/api/ColumnType.java
@@ -68,6 +68,8 @@ public interface ColumnType {
   AbstractColumnParser<?> customParser(ReadOptions options);
 
   default boolean compare(int rowNumber, Column<?> temp, Column<?> original) {
-    return original.get(rowNumber).equals(temp.get(temp.size() - 1));
+    Object o1 = original.get(rowNumber);
+    Object o2 = temp.get(temp.size() - 1);
+    return o1 == null ? o2 == null : o1.equals(o2);
   }
 }


Test patch:
diff --git a/core/src/test/java/tech/tablesaw/api/TableTest.java b/core/src/test/java/tech/tablesaw/api/TableTest.java
index bfe0506c..a40e07ec 100644
--- a/core/src/test/java/tech/tablesaw/api/TableTest.java
+++ b/core/src/test/java/tech/tablesaw/api/TableTest.java
@@ -39,6 +39,7 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import tech.tablesaw.columns.Column;
 import tech.tablesaw.columns.dates.PackedLocalDate;
+import tech.tablesaw.columns.numbers.IntColumnType;
 import tech.tablesaw.io.csv.CsvReadOptions;
 
 public class TableTest {
@@ -167,7 +168,7 @@ public class TableTest {
   }
 
   @Test
-  void testDropDuplicateRows() throws Exception {
+  void dropDuplicateRows() throws Exception {
     Table t1 = Table.read().csv("../data/bush.csv");
     int rowCount = t1.rowCount();
     Table t2 = Table.read().csv("../data/bush.csv");
@@ -178,6 +179,21 @@ public class TableTest {
     assertEquals(rowCount, t1.rowCount());
   }
 
+  @Test
+  void dropDuplicateRowsWithMissingValue() throws Exception {
+    // Add 4 rows to the table, two of which are duplicates and have missing values.
+    int missing = IntColumnType.missingValueIndicator();
+    Table t1 =
+        Table.create(
+            "T1",
+            IntColumn.create("Id", 0, 1, 2, 1),
+            StringColumn.create("Name", "Joe", "Jay", "Mike", "Jay"),
+            IntColumn.create("ChildId", 100, missing, 101, missing));
+
+    Table t2 = t1.dropDuplicateRows();
+    assertEquals(3, t2.rowCount());
+  }
+
   @Test
   void testMissingValueCounts() {
     StringColumn c1 = StringColumn.create("SC");
Repository: jtablesaw/tablesaw
Pull request #866 (2021-01-20 16:14:47)

implemented reordering of columns using column names (issue #863)
Thanks for contributing.

- [x] Tick to sign-off your agreement to the [Developer Certificate of Origin (DCO) 1.1](https://developercertificate.org)

## Description

What was changed

## Testing

Did you add a unit test?
yes


Patch:
diff --git a/core/src/main/java/tech/tablesaw/api/Table.java b/core/src/main/java/tech/tablesaw/api/Table.java
index c89e3d3d..cdcc668b 100644
--- a/core/src/main/java/tech/tablesaw/api/Table.java
+++ b/core/src/main/java/tech/tablesaw/api/Table.java
@@ -298,6 +298,23 @@ public class Table extends Relation implements Iterable<Row> {
     return this;
   }
 
+  /**
+   * Return a new table (shallow copy) that contains all the columns in this table, in the order
+   * given in the argument. Throw an IllegalArgument exception if the number of names given does not
+   * match the number of columns in this table. NOTE: This does not make a copy of the columns, so
+   * they are shared between the two tables.
+   *
+   * @param columnNames a column name or array of names
+   */
+  public Table reorderColumns(String... columnNames) {
+    Preconditions.checkArgument(columnNames.length == columnCount());
+    Table table = Table.create(name);
+    for (String name : columnNames) {
+      table.addColumns(column(name));
+    }
+    return table;
+  }
+
   /**
    * Replaces an existing column (by index) in this table with the given new column
    *


Test patch:
diff --git a/core/src/test/java/tech/tablesaw/api/TableTest.java b/core/src/test/java/tech/tablesaw/api/TableTest.java
index a40e07ec..5981110b 100644
--- a/core/src/test/java/tech/tablesaw/api/TableTest.java
+++ b/core/src/test/java/tech/tablesaw/api/TableTest.java
@@ -49,8 +49,8 @@ public class TableTest {
   private static final Random RANDOM = new Random();
 
   private Table table;
-  private DoubleColumn f1 = DoubleColumn.create("f1");
-  private DoubleColumn numberColumn = DoubleColumn.create("d1");
+  private final DoubleColumn f1 = DoubleColumn.create("f1");
+  private final DoubleColumn numberColumn = DoubleColumn.create("d1");
 
   @BeforeEach
   void setUp() {
@@ -75,6 +75,22 @@ public class TableTest {
     assertNotNull(column1);
   }
 
+  @Test
+  void reorderColumns() throws Exception {
+    Table t = Table.read().csv("../data/bush.csv");
+    List<String> names = t.columnNames();
+    assertEquals(names.get(0), "date");
+    assertEquals(names.get(1), "approval");
+    assertEquals(names.get(2), "who");
+
+    Table reordered = t.reorderColumns("who", "approval", "date");
+    List<String> reorderedNames = reordered.columnNames();
+
+    assertEquals(reorderedNames.get(0), "who");
+    assertEquals(reorderedNames.get(1), "approval");
+    assertEquals(reorderedNames.get(2), "date");
+  }
+
   @Test
   void testColumnSizeCheck() {
     assertThrows(
Repository: jtablesaw/tablesaw
Pull request #873 (2021-01-25 19:55:24)

fix issue caused by appending to initialized column, rather than sett…
…ing values

Thanks for contributing.

- [x] Tick to sign-off your agreement to the [Developer Certificate of Origin (DCO) 1.1](https://developercertificate.org)

## Description

used set(index, value) instead of append(value)

## Testing

Did you add a unit test?
yes


Patch:
diff --git a/core/src/main/java/tech/tablesaw/api/BooleanColumn.java b/core/src/main/java/tech/tablesaw/api/BooleanColumn.java
index 82c2cd5e..40724033 100644
--- a/core/src/main/java/tech/tablesaw/api/BooleanColumn.java
+++ b/core/src/main/java/tech/tablesaw/api/BooleanColumn.java
@@ -655,7 +655,7 @@ public class BooleanColumn extends AbstractColumn<BooleanColumn, Boolean>
     DoubleColumn numberColumn = DoubleColumn.create(this.name(), size());
     ByteArrayList data = data();
     for (int i = 0; i < size(); i++) {
-      numberColumn.append(data.getByte(i));
+      numberColumn.set(i, data.getByte(i));
     }
     return numberColumn;
   }


Test patch:
diff --git a/core/src/test/java/tech/tablesaw/api/BooleanColumnTest.java b/core/src/test/java/tech/tablesaw/api/BooleanColumnTest.java
index 66b42fd0..13350cab 100644
--- a/core/src/test/java/tech/tablesaw/api/BooleanColumnTest.java
+++ b/core/src/test/java/tech/tablesaw/api/BooleanColumnTest.java
@@ -53,6 +53,12 @@ public class BooleanColumnTest {
     assertTrue(filtered.all());
   }
 
+  @Test
+  public void asDoubleColumn() {
+    DoubleColumn doubleColumn = column.asDoubleColumn();
+    assertEquals(column.size(), doubleColumn.size());
+  }
+
   @Test
   public void inRange() {
     assertFalse(column.all());
Repository: jtablesaw/tablesaw
Pull request #883 (2021-02-05 16:47:54)

added "N/A" as a default mssing value indicator, plus test
Thanks for contributing.

- [x] Tick to sign-off your agreement to the [Developer Certificate of Origin (DCO) 1.1](https://developercertificate.org)

## Description

What was changed
as described in title, plus a test. 

## Testing

Did you add a unit test?
Yes


Patch:
diff --git a/core/src/main/java/tech/tablesaw/io/TypeUtils.java b/core/src/main/java/tech/tablesaw/io/TypeUtils.java
index a738f1bb..fbcc01b5 100644
--- a/core/src/main/java/tech/tablesaw/io/TypeUtils.java
+++ b/core/src/main/java/tech/tablesaw/io/TypeUtils.java
@@ -28,8 +28,9 @@ public final class TypeUtils {
   private static final String missingInd2 = "*";
   private static final String missingInd3 = "NA";
   private static final String missingInd4 = "null";
+  private static final String missingInd5 = "N/A";
   public static final ImmutableList<String> MISSING_INDICATORS =
-      ImmutableList.of(missingInd1, missingInd2, missingInd3, missingInd4);
+      ImmutableList.of(missingInd1, missingInd2, missingInd3, missingInd4, missingInd5);
 
   /** Private constructor to prevent instantiation */
   private TypeUtils() {}
diff --git a/data/missing_values2.csv b/data/missing_values2.csv
new file mode 100644
index 00000000..d29e395d
--- /dev/null
+++ b/data/missing_values2.csv
@@ -0,0 +1,6 @@
+Products,Sales,Market_Share
+a,5500,3
+b,12200,NA
+c,60000,33
+d,N/A,10
+,32000,42


Test patch:
diff --git a/core/src/test/java/tech/tablesaw/io/csv/CsvReaderTest.java b/core/src/test/java/tech/tablesaw/io/csv/CsvReaderTest.java
index e6bd83aa..c126144c 100644
--- a/core/src/test/java/tech/tablesaw/io/csv/CsvReaderTest.java
+++ b/core/src/test/java/tech/tablesaw/io/csv/CsvReaderTest.java
@@ -489,6 +489,22 @@ public class CsvReaderTest {
     assertEquals(1, t.numberColumn(2).countMissing());
   }
 
+  /** Tests the auto-detection of missing values, using multiple missing value indicators */
+  @Test
+  public void testWithMissingValue2() throws IOException {
+
+    CsvReadOptions options =
+        CsvReadOptions.builder("../data/missing_values2.csv")
+            .dateFormat(DateTimeFormatter.ofPattern("yyyy.MM.dd"))
+            .header(true)
+            .build();
+
+    Table t = Table.read().csv(options);
+    assertEquals(1, t.stringColumn(0).countMissing());
+    assertEquals(1, t.numberColumn(1).countMissing());
+    assertEquals(1, t.numberColumn(2).countMissing());
+  }
+
   @Test
   public void testWindowsAndLinuxLineEndings() throws IOException {
     Reader reader =
Repository: rust-lang/rust-analyzer
Pull request #18078 (2024-09-09 08:36:58)

Remove unnecessary symbols and add missing symbols


Patch:
diff --git a/crates/hir-expand/src/declarative.rs b/crates/hir-expand/src/declarative.rs
index b1a6eed2fb..86dd4aef09 100644
--- a/crates/hir-expand/src/declarative.rs
+++ b/crates/hir-expand/src/declarative.rs
@@ -1,4 +1,4 @@
-//! Compiled declarative macro expanders (`macro_rules!`` and `macro`)
+//! Compiled declarative macro expanders (`macro_rules!` and `macro`)
 
 use base_db::CrateId;
 use intern::sym;
diff --git a/crates/ide-assists/src/handlers/inline_type_alias.rs b/crates/ide-assists/src/handlers/inline_type_alias.rs
index f6624d6c87..66dffde505 100644
--- a/crates/ide-assists/src/handlers/inline_type_alias.rs
+++ b/crates/ide-assists/src/handlers/inline_type_alias.rs
@@ -43,6 +43,7 @@ use super::inline_call::split_refs_and_uses;
 // fn foo() {
 //     let _: i32 = 3;
 // }
+// ```
 pub(crate) fn inline_type_alias_uses(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()> {
     let name = ctx.find_node_at_offset::<ast::Name>()?;
     let ast_alias = name.syntax().parent().and_then(ast::TypeAlias::cast)?;
diff --git a/crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs b/crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs
index 0fa46ef43a..149cb4c438 100644
--- a/crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs
+++ b/crates/ide-assists/src/handlers/wrap_unwrap_cfg_attr.rs
@@ -25,6 +25,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists};
 // struct S {
 //    field: i32
 // }
+// ```
 
 enum WrapUnwrapOption {
     WrapDerive { derive: TextRange, attr: ast::Attr },
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index e4e8c9c6d9..3295ec258e 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -60,7 +60,7 @@ mod patch_old_style;
 // However, editor specific config, which the server doesn't know about, should
 // be specified directly in `package.json`.
 //
-// To deprecate an option by replacing it with another name use `new_name | `old_name` so that we keep
+// To deprecate an option by replacing it with another name use `new_name` | `old_name` so that we keep
 // parsing the old name.
 config_data! {
     /// Configs that apply on a workspace-wide scope. There are 2 levels on which a global configuration can be configured


Test patch:
diff --git a/crates/rust-analyzer/tests/slow-tests/ratoml.rs b/crates/rust-analyzer/tests/slow-tests/ratoml.rs
index 295d1d4e8e..a3e7528b39 100644
--- a/crates/rust-analyzer/tests/slow-tests/ratoml.rs
+++ b/crates/rust-analyzer/tests/slow-tests/ratoml.rs
@@ -765,7 +765,7 @@ fn ratoml_multiple_ratoml_in_single_source_root() {
 
 // [dependencies]
 // p2 = { path = "../p2" }
-// #,
+// "#,
 //                 r#"
 // //- /p1/src/lib.rs
 // enum Value {
Repository: rust-lang/rust-analyzer
Pull request #18226 (2024-10-01 21:12:02)

Correctly parse `use` in generic parameters
Fixes: #18225


Patch:
diff --git a/crates/parser/src/grammar/generic_params.rs b/crates/parser/src/grammar/generic_params.rs
index e0fa753fa7..ecfabca092 100644
--- a/crates/parser/src/grammar/generic_params.rs
+++ b/crates/parser/src/grammar/generic_params.rs
@@ -145,7 +145,7 @@ fn type_bound(p: &mut Parser<'_>) -> bool {
         T![for] => types::for_type(p, false),
         // test precise_capturing
         // fn captures<'a: 'a, 'b: 'b, T>() -> impl Sized + use<'b, T> {}
-        T![use] => {
+        T![use] if p.nth_at(1, T![<]) => {
             p.bump_any();
             generic_param_list(p)
         }


Test patch:
diff --git a/crates/parser/test_data/parser/err/0055_impl_use.rast b/crates/parser/test_data/parser/err/0055_impl_use.rast
new file mode 100644
index 0000000000..751f007df9
--- /dev/null
+++ b/crates/parser/test_data/parser/err/0055_impl_use.rast
@@ -0,0 +1,26 @@
+SOURCE_FILE
+  IMPL
+    IMPL_KW "impl"
+    GENERIC_PARAM_LIST
+      L_ANGLE "<"
+      TYPE_PARAM
+        NAME
+          IDENT "T"
+        COLON ":"
+        WHITESPACE "\n"
+        TYPE_BOUND_LIST
+    ERROR
+      USE_KW "use"
+  WHITESPACE " "
+  MACRO_CALL
+    PATH
+      PATH_SEGMENT
+        NAME_REF
+          IDENT "std"
+    SEMICOLON ";"
+  WHITESPACE "\n"
+error 8: expected R_ANGLE
+error 8: expected type
+error 11: expected `{`
+error 15: expected BANG
+error 15: expected `{`, `[`, `(`
diff --git a/crates/parser/test_data/parser/err/0055_impl_use.rs b/crates/parser/test_data/parser/err/0055_impl_use.rs
new file mode 100644
index 0000000000..571552bda8
--- /dev/null
+++ b/crates/parser/test_data/parser/err/0055_impl_use.rs
@@ -0,0 +1,2 @@
+impl<T:
+use std;
Repository: rust-lang/rust-analyzer
Pull request #19030 (2025-01-25 13:07:25)

fix: Fix markdown horizontal ruler sometimes being treated as a heading
Fixes https://github.com/rust-lang/rust-analyzer/issues/19027


Patch:
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 18a3fed07e..9d4c103fc2 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -346,7 +346,7 @@ fn hover_offset(
         .unique()
         .reduce(|mut acc: HoverResult, HoverResult { markup, actions }| {
             acc.actions.extend(actions);
-            acc.markup = Markup::from(format!("{}\n---\n{markup}", acc.markup));
+            acc.markup = Markup::from(format!("{}\n\n---\n{markup}", acc.markup));
             acc
         })
         .map(|mut res: HoverResult| {


Test patch:
diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs
index 064a845dc5..8c32cc9720 100644
--- a/crates/ide/src/hover/tests.rs
+++ b/crates/ide/src/hover/tests.rs
@@ -303,6 +303,7 @@ m!(ab$0c);
             ---
 
             Outer
+
             ---
 
             ```rust
@@ -4401,6 +4402,7 @@ fn main() {
             ---
 
             size = 8, align = 8, niches = 1
+
             ---
 
             ```rust
@@ -10094,6 +10096,7 @@ fn bar() {
             ```rust
             let field: i32
             ```
+
             ---
 
             ```rust
@@ -10128,6 +10131,7 @@ fn bar() {
             ---
 
             size = 4, align = 4
+
             ---
 
             ```rust