Unverified Commit bb9da33c authored by Johannes Kirschbauer's avatar Johannes Kirschbauer Committed by GitHub
Browse files

lib/*: fix docs to use "returns" instead of "return" (#442388)

parents b9d271b6 06ac3fbe
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ rec {
    ;

  /**
    Return an attribute from nested attribute sets.
    Returns an attribute from nested attribute sets.

    Nix has an [attribute selection operator `.`](https://nixos.org/manual/nix/stable/language/operators#attribute-selection) which is sufficient for such queries, as long as the number of attributes is static. For example:

@@ -111,7 +111,7 @@ rec {
    attrByPath' 0 set;

  /**
    Return if an attribute from nested attribute set exists.
    Returns if an attribute from nested attribute set exists.

    Nix has a [has attribute operator `?`](https://nixos.org/manual/nix/stable/language/operators#has-attribute), which is sufficient for such queries, as long as the number of attributes is static. For example:

@@ -177,7 +177,7 @@ rec {
    hasAttrByPath' 0 e;

  /**
    Return the longest prefix of an attribute path that refers to an existing attribute in a nesting of attribute sets.
    Returns the longest prefix of an attribute path that refers to an existing attribute in a nesting of attribute sets.

    Can be used after [`mapAttrsRecursiveCond`](#function-library-lib.attrsets.mapAttrsRecursiveCond) to apply a condition,
    although this will evaluate the predicate function on sibling attributes as well.
@@ -504,7 +504,7 @@ rec {
    updates: value: go 0 true value updates;

  /**
    Return the specified attributes from a set.
    Returns the specified attributes from a set.

    # Inputs

@@ -536,7 +536,7 @@ rec {
  attrVals = nameList: set: map (x: set.${x}) nameList;

  /**
    Return the values of all attributes in the given set, sorted by
    Returns the values of all attributes in the given set, sorted by
    attribute name.

    # Type
+2 −2
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ let
    name: default: attrs:
    attrs.${name} or default;

  # Return the second argument if the first one is true or the empty version
  # Returns the second argument if the first one is true or the empty version
  # of the second argument.
  ifEnable =
    cond: val:
@@ -89,7 +89,7 @@ let
    else
      null;

  # Return true only if there is an attribute and it is true.
  # Returns true only if there is an attribute and it is true.
  checkFlag =
    attrSet: name:
    if name == "true" then
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ rec {
    x;

  /**
    Return the fixpoint that `f` converges to when called iteratively, starting
    Returns the fixpoint that `f` converges to when called iteratively, starting
    with the input `x`.

    ```
+11 −11
Original line number Diff line number Diff line
@@ -642,7 +642,7 @@ rec {
    if index == null then default else elemAt list index;

  /**
    Return true if function `pred` returns true for at least one
    Returns true if function `pred` returns true for at least one
    element of `list`.

    # Inputs
@@ -677,7 +677,7 @@ rec {
  any = builtins.any;

  /**
    Return true if function `pred` returns true for all elements of
    Returns true if function `pred` returns true for all elements of
    `list`.

    # Inputs
@@ -777,7 +777,7 @@ rec {
  optional = cond: elem: if cond then [ elem ] else [ ];

  /**
    Return a list or an empty list, depending on a boolean value.
    Returns a list or an empty list, depending on a boolean value.

    # Inputs

@@ -837,7 +837,7 @@ rec {
  toList = x: if isList x then x else [ x ];

  /**
    Return a list of integers from `first` up to and including `last`.
    Returns a list of integers from `first` up to and including `last`.

    # Inputs

@@ -871,7 +871,7 @@ rec {
  range = first: last: if first > last then [ ] else genList (n: first + n) (last - first + 1);

  /**
    Return a list with `n` copies of an element.
    Returns a list with `n` copies of an element.

    # Inputs

@@ -1429,7 +1429,7 @@ rec {
    map (x: elemAt x 1) (sort less prepared);

  /**
    Return the first (at most) N elements of a list.
    Returns the first (at most) N elements of a list.

    # Inputs

@@ -1463,7 +1463,7 @@ rec {
  take = count: sublist 0 count;

  /**
    Return the last (at most) N elements of a list.
    Returns the last (at most) N elements of a list.

    # Inputs

@@ -1639,7 +1639,7 @@ rec {
      throw "lib.lists.removePrefix: First argument is not a list prefix of the second argument";

  /**
    Return a list consisting of at most `count` elements of `list`,
    Returns a list consisting of at most `count` elements of `list`,
    starting at index `start`.

    # Inputs
@@ -1737,7 +1737,7 @@ rec {
    take commonPrefixLength list1;

  /**
    Return the last element of a list.
    Returns the last element of a list.

    This function throws an error if the list is empty.

@@ -1770,7 +1770,7 @@ rec {
    elemAt list (length list - 1);

  /**
    Return all elements but the last.
    Returns all elements but the last.

    This function throws an error if the list is empty.

@@ -1803,7 +1803,7 @@ rec {
    take (length list - 1) list;

  /**
    Return the image of the cross product of some lists by a function.
    Returns the image of the cross product of some lists by a function.

    # Examples
    :::{.example}
+6 −6
Original line number Diff line number Diff line
@@ -1452,7 +1452,7 @@ let
  };

  /**
    Return a definition with file location information.
    Returns a definition with file location information.
  */
  mkDefinition = args@{ file, value, ... }: args // { _type = "definition"; };

@@ -1541,7 +1541,7 @@ let
    };

  /**
    Return a module that causes a warning to be shown if the
    Returns a module that causes a warning to be shown if the
    specified option is defined. For example,

      mkRemovedOptionModule [ "boot" "loader" "grub" "bootDevice" ] "<replacement instructions>"
@@ -1589,7 +1589,7 @@ let
    };

  /**
    Return a module that causes a warning to be shown if the
    Returns a module that causes a warning to be shown if the
    specified "from" option is defined; the defined value is however
    forwarded to the "to" option. This can be used to rename options
    while providing backward compatibility. For example,
@@ -1645,7 +1645,7 @@ let
    };

  /**
    Return a module that causes a warning to be shown if any of the "from"
    Returns a module that causes a warning to be shown if any of the "from"
    option is defined; the defined values can be used in the "mergeFn" to set
    the "to" value.
    This function can be used to merge multiple options into one that has a
@@ -1724,7 +1724,7 @@ let

  /**
    Single "from" version of mkMergedOptionModule.
    Return a module that causes a warning to be shown if the "from" option is
    Returns a module that causes a warning to be shown if the "from" option is
    defined; the defined value can be used in the "mergeFn" to set the "to"
    value.
    This function can be used to change an option into another that has a
@@ -1822,7 +1822,7 @@ let
  mkDerivedConfig = opt: f: mkOverride (opt.highestPrio or defaultOverridePriority) (f opt.value);

  /**
    Return a module that help declares an option that has been renamed.
    Returns a module that help declares an option that has been renamed.
    When a value is defined for the old option, it is forwarded to the `to` option.
  */
  doRename =
Loading