Skip to content

Commit ab5fc97

Browse files
domoritzjorgecarleitao
authored andcommitted
ARROW-11389: [Rust] make comments more consistent and fix typos
Closes #9327 from domoritz/dom/comments Authored-by: Dominik Moritz <domoritz@gmail.com> Signed-off-by: Jorge C. Leitao <jorgecarleitao@gmail.com>
1 parent 5665a0c commit ab5fc97

3 files changed

Lines changed: 24 additions & 24 deletions

File tree

rust/arrow/src/array/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub(crate) fn mutable_buffer_to_builder<T: ArrowNativeType>(
4747
}
4848
}
4949

50-
/// Converts a `BufferBuilder<T>` into it's underlying `MutableBuffer`.
50+
/// Converts a `BufferBuilder<T>` into its underlying `MutableBuffer`.
5151
///
5252
/// `From` is not implemented because associated type bounds are unstable.
5353
pub(crate) fn builder_to_mutable_buffer<T: ArrowNativeType>(

rust/arrow/src/datatypes.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ impl fmt::Display for DataType {
992992
}
993993

994994
impl DataType {
995-
/// Parse a data type from a JSON representation
995+
/// Parse a data type from a JSON representation.
996996
pub(crate) fn from(json: &Value) -> Result<DataType> {
997997
let default_field = Field::new("", DataType::Boolean, true);
998998
match *json {
@@ -1180,7 +1180,7 @@ impl DataType {
11801180
}
11811181
}
11821182

1183-
/// Generate a JSON representation of the data type
1183+
/// Generate a JSON representation of the data type.
11841184
pub fn to_json(&self) -> Value {
11851185
match self {
11861186
DataType::Null => json!({"name": "null"}),
@@ -1265,7 +1265,7 @@ impl DataType {
12651265
}
12661266
}
12671267

1268-
/// Returns true if this type is numeric: (UInt*, Unit*, or Float*)
1268+
/// Returns true if this type is numeric: (UInt*, Unit*, or Float*).
12691269
pub fn is_numeric(t: &DataType) -> bool {
12701270
use DataType::*;
12711271
matches!(
@@ -1284,7 +1284,7 @@ impl DataType {
12841284
}
12851285

12861286
/// Compares the datatype with another, ignoring nested field names
1287-
/// and metadata
1287+
/// and metadata.
12881288
pub(crate) fn equals_datatype(&self, other: &DataType) -> bool {
12891289
match (&self, other) {
12901290
(DataType::List(a), DataType::List(b))
@@ -1359,25 +1359,25 @@ impl Field {
13591359
&self.metadata
13601360
}
13611361

1362-
/// Returns an immutable reference to the `Field`'s name
1362+
/// Returns an immutable reference to the `Field`'s name.
13631363
#[inline]
13641364
pub const fn name(&self) -> &String {
13651365
&self.name
13661366
}
13671367

1368-
/// Returns an immutable reference to the `Field`'s data-type
1368+
/// Returns an immutable reference to the `Field`'s data-type.
13691369
#[inline]
13701370
pub const fn data_type(&self) -> &DataType {
13711371
&self.data_type
13721372
}
13731373

1374-
/// Indicates whether this `Field` supports null values
1374+
/// Indicates whether this `Field` supports null values.
13751375
#[inline]
13761376
pub const fn is_nullable(&self) -> bool {
13771377
self.nullable
13781378
}
13791379

1380-
/// Returns the dictionary ID, if this is a dictionary type
1380+
/// Returns the dictionary ID, if this is a dictionary type.
13811381
#[inline]
13821382
pub const fn dict_id(&self) -> Option<i64> {
13831383
match self.data_type {
@@ -1386,7 +1386,7 @@ impl Field {
13861386
}
13871387
}
13881388

1389-
/// Returns whether this `Field`'s dictionary is ordered, if this is a dictionary type
1389+
/// Returns whether this `Field`'s dictionary is ordered, if this is a dictionary type.
13901390
#[inline]
13911391
pub const fn dict_is_ordered(&self) -> Option<bool> {
13921392
match self.data_type {
@@ -1395,7 +1395,7 @@ impl Field {
13951395
}
13961396
}
13971397

1398-
/// Parse a `Field` definition from a JSON representation
1398+
/// Parse a `Field` definition from a JSON representation.
13991399
pub fn from(json: &Value) -> Result<Self> {
14001400
match *json {
14011401
Value::Object(ref map) => {
@@ -1592,7 +1592,7 @@ impl Field {
15921592
}
15931593
}
15941594

1595-
/// Generate a JSON representation of the `Field`
1595+
/// Generate a JSON representation of the `Field`.
15961596
pub fn to_json(&self) -> Value {
15971597
let children: Vec<Value> = match self.data_type() {
15981598
DataType::Struct(fields) => fields.iter().map(|f| f.to_json()).collect(),
@@ -1788,7 +1788,7 @@ impl Schema {
17881788
}
17891789
}
17901790

1791-
/// Creates a new `Schema` from a sequence of `Field` values
1791+
/// Creates a new `Schema` from a sequence of `Field` values.
17921792
///
17931793
/// # Example
17941794
///
@@ -1897,33 +1897,33 @@ impl Schema {
18971897
Ok(merged)
18981898
}
18991899

1900-
/// Returns an immutable reference of the vector of `Field` instances
1900+
/// Returns an immutable reference of the vector of `Field` instances.
19011901
#[inline]
19021902
pub const fn fields(&self) -> &Vec<Field> {
19031903
&self.fields
19041904
}
19051905

19061906
/// Returns an immutable reference of a specific `Field` instance selected using an
1907-
/// offset within the internal `fields` vector
1907+
/// offset within the internal `fields` vector.
19081908
pub fn field(&self, i: usize) -> &Field {
19091909
&self.fields[i]
19101910
}
19111911

1912-
/// Returns an immutable reference of a specific `Field` instance selected by name
1912+
/// Returns an immutable reference of a specific `Field` instance selected by name.
19131913
pub fn field_with_name(&self, name: &str) -> Result<&Field> {
19141914
Ok(&self.fields[self.index_of(name)?])
19151915
}
19161916

19171917
/// Returns a vector of immutable references to all `Field` instances selected by
1918-
/// the dictionary ID they use
1918+
/// the dictionary ID they use.
19191919
pub fn fields_with_dict_id(&self, dict_id: i64) -> Vec<&Field> {
19201920
self.fields
19211921
.iter()
19221922
.filter(|f| f.dict_id() == Some(dict_id))
19231923
.collect()
19241924
}
19251925

1926-
/// Find the index of the column with the given name
1926+
/// Find the index of the column with the given name.
19271927
pub fn index_of(&self, name: &str) -> Result<usize> {
19281928
for i in 0..self.fields.len() {
19291929
if self.fields[i].name == name {
@@ -1945,23 +1945,23 @@ impl Schema {
19451945
}
19461946

19471947
/// Look up a column by name and return a immutable reference to the column along with
1948-
/// it's index
1948+
/// its index.
19491949
pub fn column_with_name(&self, name: &str) -> Option<(usize, &Field)> {
19501950
self.fields
19511951
.iter()
19521952
.enumerate()
19531953
.find(|&(_, c)| c.name == name)
19541954
}
19551955

1956-
/// Generate a JSON representation of the `Schema`
1956+
/// Generate a JSON representation of the `Schema`.
19571957
pub fn to_json(&self) -> Value {
19581958
json!({
19591959
"fields": self.fields.iter().map(|field| field.to_json()).collect::<Vec<Value>>(),
19601960
"metadata": serde_json::to_value(&self.metadata).unwrap()
19611961
})
19621962
}
19631963

1964-
/// Parse a `Schema` definition from a JSON representation
1964+
/// Parse a `Schema` definition from a JSON representation.
19651965
pub fn from(json: &Value) -> Result<Self> {
19661966
match *json {
19671967
Value::Object(ref schema) => {
@@ -1990,8 +1990,8 @@ impl Schema {
19901990
}
19911991
}
19921992

1993-
/// Parse a `metadata` definition from a JSON representation
1994-
/// The JSON can either be an Object or an Array of Objects
1993+
/// Parse a `metadata` definition from a JSON representation.
1994+
/// The JSON can either be an Object or an Array of Objects.
19951995
fn from_metadata(json: &Value) -> Result<HashMap<String, String>> {
19961996
match json {
19971997
Value::Array(_) => {

rust/arrow/src/util/test_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ fn get_data_dir(udf_env: &str, submodule_data: &str) -> Result<PathBuf, Box<dyn
135135
}
136136
}
137137

138-
// The env is undefined or it's value is trimmed to empty, let's try default dir.
138+
// The env is undefined or its value is trimmed to empty, let's try default dir.
139139

140140
// env "CARGO_MANIFEST_DIR" is "the directory containing the manifest of your package",
141141
// set by `cargo run` or `cargo test`, see:

0 commit comments

Comments
 (0)